diff options
80 files changed, 2416 insertions, 1685 deletions
diff --git a/lib/lists.nix b/lib/lists.nix index d075a02d4755..f9f30412770a 100644 --- a/lib/lists.nix +++ b/lib/lists.nix @@ -88,7 +88,7 @@ rec { /* Strict version of `foldl`. The difference is that evaluation is forced upon access. Usually used - with small whole results (in contract with lazily-generated list or large + with small whole results (in contrast with lazily-generated list or large lists where only a part is consumed.) Type: foldl' :: (b -> a -> b) -> b -> [a] -> b diff --git a/lib/sources.nix b/lib/sources.nix index c4680087b245..51bcf5559e32 100644 --- a/lib/sources.nix +++ b/lib/sources.nix @@ -36,18 +36,47 @@ rec { # allowing you to chain multiple calls together without any # intermediate copies being put in the nix store. # - # lib.cleanSourceWith f (lib.cleanSourceWith g ./.) # Succeeds! - # builtins.filterSource f (builtins.filterSource g ./.) # Fails! - cleanSourceWith = { filter, src }: + # lib.cleanSourceWith { + # filter = f; + # src = lib.cleanSourceWith { + # filter = g; + # src = ./.; + # }; + # } + # # Succeeds! + # + # builtins.filterSource f (builtins.filterSource g ./.) + # # Fails! + # + # Parameters: + # + # src: A path or cleanSourceWith result to filter and/or rename. + # + # filter: A function (path -> type -> bool) + # Optional with default value: constant true (include everything) + # The function will be combined with the && operator such + # that src.filter is called lazily. + # For implementing a filter, see + # https://nixos.org/nix/manual/#builtin-filterSource + # + # name: Optional name to use as part of the store path. + # This defaults `src.name` or otherwise `baseNameOf src`. + # We recommend setting `name` whenever `src` is syntactically `./.`. + # Otherwise, you depend on `./.`'s name in the parent directory, + # which can cause inconsistent names, defeating caching. + # + cleanSourceWith = { filter ? _path: _type: true, src, name ? null }: let isFiltered = src ? _isLibCleanSourceWith; origSrc = if isFiltered then src.origSrc else src; filter' = if isFiltered then name: type: filter name type && src.filter name type else filter; + name' = if name != null then name else if isFiltered then src.name else baseNameOf src; in { inherit origSrc; filter = filter'; - outPath = builtins.filterSource filter' origSrc; + outPath = builtins.path { filter = filter'; path = origSrc; name = name'; }; _isLibCleanSourceWith = true; + name = name'; }; # Filter sources by a list of regular expressions. diff --git a/nixos/doc/manual/release-notes/rl-1909.xml b/nixos/doc/manual/release-notes/rl-1909.xml index ee6ef883068e..ee3b03581529 100644 --- a/nixos/doc/manual/release-notes/rl-1909.xml +++ b/nixos/doc/manual/release-notes/rl-1909.xml @@ -144,6 +144,32 @@ but will make sure that the given printers are configured as declared. </para> </listitem> + <listitem> + <para> + There is a new <xref linkend="opt-services.system-config-printer.enable"/> and <xref linkend="opt-programs.system-config-printer.enable"/> module + for the program of the same name. If you previously had <literal>system-config-printer</literal> enabled through some other + means you should migrate to using one of these modules. + </para> + <itemizedlist> + <para>If you're a user of the following desktopManager modules no action is needed:</para> + <listitem> + <para><option>services.xserver.desktopManager.plasma5</option></para> + </listitem> + <listitem> + <para><option>services.xserver.desktopManager.gnome3</option></para> + </listitem> + <listitem> + <para><option>services.xserver.desktopManager.pantheon</option></para> + </listitem> + <listitem> + <para><option>services.xserver.desktopManager.mate</option></para> + <para> + Note Mate uses <literal>programs.system-config-printer</literal> as it doesn't + use it as a service, but its graphical interface directly. + </para> + </listitem> + </itemizedlist> + </listitem> </itemizedlist> </section> @@ -438,7 +464,14 @@ <literal>packetbeat5</literal>) of the ELK-stack and Elastic beats have been removed. </para> </listitem> - + <listitem> + <para> + For NixOS 19.03, both Prometheus 1 and 2 were available to allow for + a seamless transition from version 1 to 2 with existing setups. + Because Prometheus 1 is no longer developed, it was removed. + Prometheus 2 is now configured with <literal>services.prometheus</literal>. + </para> + </listitem> </itemizedlist> </section> diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index fe28cf7fa492..c21973faa89f 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -151,6 +151,7 @@ ./programs/sysdig.nix ./programs/systemtap.nix ./programs/sway.nix + ./programs/system-config-printer.nix ./programs/thefuck.nix ./programs/tmux.nix ./programs/tsm-client.nix @@ -309,6 +310,7 @@ ./services/desktops/gnome3/tracker.nix ./services/desktops/gnome3/tracker-miners.nix ./services/desktops/profile-sync-daemon.nix + ./services/desktops/system-config-printer.nix ./services/desktops/telepathy.nix ./services/desktops/tumbler.nix ./services/desktops/zeitgeist.nix diff --git a/nixos/modules/programs/system-config-printer.nix b/nixos/modules/programs/system-config-printer.nix new file mode 100644 index 000000000000..34592dd7064b --- /dev/null +++ b/nixos/modules/programs/system-config-printer.nix @@ -0,0 +1,32 @@ +{ config, pkgs, lib, ... }: + +with lib; + +{ + + ###### interface + + options = { + + programs.system-config-printer = { + + enable = mkEnableOption "system-config-printer, a Graphical user interface for CUPS administration"; + + }; + + }; + + + ###### implementation + + config = mkIf config.programs.system-config-printer.enable { + + environment.systemPackages = [ + pkgs.system-config-printer + ]; + + services.system-config-printer.enable = true; + + }; + +} diff --git a/nixos/modules/rename.nix b/nixos/modules/rename.nix index 1fa91f05030d..d1303f90ad8d 100644 --- a/nixos/modules/rename.nix +++ b/nixos/modules/rename.nix @@ -52,10 +52,11 @@ with lib; (mkRemovedOptionModule [ "services" "misc" "nzbget" "openFirewall" ] "The port used by nzbget is managed through the web interface so you should adjust your firewall rules accordingly.") (mkRemovedOptionModule [ "services" "prometheus" "alertmanager" "user" ] "The alertmanager service is now using systemd's DynamicUser mechanism which obviates a user setting.") (mkRemovedOptionModule [ "services" "prometheus" "alertmanager" "group" ] "The alertmanager service is now using systemd's DynamicUser mechanism which obviates a group setting.") - (mkRemovedOptionModule [ "services" "prometheus2" "alertmanagerURL" ] '' + (mkRemovedOptionModule [ "services" "prometheus" "alertmanagerURL" ] '' Due to incompatibility, the alertmanagerURL option has been removed, please use 'services.prometheus2.alertmanagers' instead. '') + (mkRenamedOptionModule [ "services" "prometheus2" ] [ "services" "prometheus" ]) (mkRenamedOptionModule [ "services" "tor" "relay" "portSpec" ] [ "services" "tor" "relay" "port" ]) (mkRenamedOptionModule [ "services" "vmwareGuest" ] [ "virtualisation" "vmware" "guest" ]) (mkRenamedOptionModule [ "jobs" ] [ "systemd" "services" ]) diff --git a/nixos/modules/services/desktops/system-config-printer.nix b/nixos/modules/services/desktops/system-config-printer.nix new file mode 100644 index 000000000000..8a80be266b20 --- /dev/null +++ b/nixos/modules/services/desktops/system-config-printer.nix @@ -0,0 +1,38 @@ +{ config, pkgs, lib, ... }: + +with lib; + +{ + + ###### interface + + options = { + + services.system-config-printer = { + + enable = mkEnableOption "system-config-printer, a service for CUPS administration used by printing interfaces"; + + }; + + }; + + + ###### implementation + + config = mkIf config.services.system-config-printer.enable { + + services.dbus.packages = [ + pkgs.system-config-printer + ]; + + systemd.packages = [ + pkgs.system-config-printer + ]; + + services.udev.packages = [ + pkgs.system-config-printer + ]; + + }; + +} diff --git a/nixos/modules/services/monitoring/prometheus/default.nix b/nixos/modules/services/monitoring/prometheus/default.nix index 647d67533b89..191c0bff9c84 100644 --- a/nixos/modules/services/monitoring/prometheus/default.nix +++ b/nixos/modules/services/monitoring/prometheus/default.nix @@ -4,37 +4,14 @@ with lib; let cfg = config.services.prometheus; - cfg2 = config.services.prometheus2; - promUser = "prometheus"; - promGroup = "prometheus"; - - stateDir = - if cfg.stateDir != null - then cfg.stateDir - else - if cfg.dataDir != null - then - # This assumes /var/lib/ is a prefix of cfg.dataDir. - # This is checked as an assertion below. - removePrefix stateDirBase cfg.dataDir - else "prometheus"; - stateDirBase = "/var/lib/"; - workingDir = stateDirBase + stateDir; - workingDir2 = stateDirBase + cfg2.stateDir; - # a wrapper that verifies that the configuration is valid - promtoolCheck = what: name: file: pkgs.runCommand "${name}-${what}-checked" - { buildInputs = [ cfg.package ]; } '' - ln -s ${file} $out - promtool ${what} $out - ''; + workingDir = "/var/lib/" + cfg.stateDir; - # a wrapper that verifies that the configuration is valid for - # prometheus 2 - prom2toolCheck = what: name: file: + # a wrapper that verifies that the configuration is valid + promtoolCheck = what: name: file: pkgs.runCommand "${name}-${replaceStrings [" "] [""] what}-checked" - { buildInputs = [ cfg2.package ]; } '' + { buildInputs = [ cfg.package ]; } '' ln -s ${file} $out promtool ${what} $out ''; @@ -45,61 +22,34 @@ let echo '${builtins.toJSON x}' | ${pkgs.jq}/bin/ |