mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-25 16:33:15 +00:00
Merge pull request #328381 from tie/map-attrs-flatten
This commit is contained in:
commit
473e469d5a
@ -29,9 +29,10 @@ let
|
||||
nameValuePair
|
||||
tail
|
||||
toList
|
||||
warn
|
||||
;
|
||||
|
||||
inherit (lib.attrsets) removeAttrs;
|
||||
inherit (lib.attrsets) removeAttrs mapAttrsToList;
|
||||
|
||||
# returns default if env var is not set
|
||||
maybeEnv = name: default:
|
||||
@ -212,7 +213,7 @@ let
|
||||
else closePropagationSlow;
|
||||
|
||||
# calls a function (f attr value ) for each record item. returns a list
|
||||
mapAttrsFlatten = f: r: map (attr: f attr r.${attr}) (attrNames r);
|
||||
mapAttrsFlatten = warn "lib.misc.mapAttrsFlatten is deprecated, please use lib.attrsets.mapAttrsToList instead." mapAttrsToList;
|
||||
|
||||
# attribute set containing one attribute
|
||||
nvs = name: value: listToAttrs [ (nameValuePair name value) ];
|
||||
|
@ -252,6 +252,8 @@
|
||||
|
||||
- [`lib.options.mkPackageOptionMD`](https://nixos.org/manual/nixpkgs/unstable#function-library-lib.options.mkPackageOptionMD) is now obsolete; use the identical [`lib.options.mkPackageOption`](https://nixos.org/manual/nixpkgs/unstable#function-library-lib.options.mkPackageOption) instead.
|
||||
|
||||
- `lib.misc.mapAttrsFlatten` is now formally deprecated and will be removed in future releases; use the identical [`lib.attrsets.mapAttrsToList`](https://nixos.org/manual/nixpkgs/unstable#function-library-lib.attrsets.mapAttrsToList) instead.
|
||||
|
||||
- `nixosTests` now provide a working IPv6 setup for VLAN 1 by default.
|
||||
|
||||
- To facilitate dependency injection, the `imgui` package now builds a static archive using vcpkg' CMake rules.
|
||||
|
@ -10,7 +10,7 @@ let
|
||||
cfg = config.programs.bash;
|
||||
|
||||
bashAliases = builtins.concatStringsSep "\n" (
|
||||
lib.mapAttrsFlatten (k: v: "alias -- ${k}=${lib.escapeShellArg v}")
|
||||
lib.mapAttrsToList (k: v: "alias -- ${k}=${lib.escapeShellArg v}")
|
||||
(lib.filterAttrs (k: v: v != null) cfg.shellAliases)
|
||||
);
|
||||
|
||||
|
@ -7,12 +7,12 @@ let
|
||||
cfg = config.programs.fish;
|
||||
|
||||
fishAbbrs = lib.concatStringsSep "\n" (
|
||||
lib.mapAttrsFlatten (k: v: "abbr -ag ${k} ${lib.escapeShellArg v}")
|
||||
lib.mapAttrsToList (k: v: "abbr -ag ${k} ${lib.escapeShellArg v}")
|
||||
cfg.shellAbbrs
|
||||
);
|
||||
|
||||
fishAliases = lib.concatStringsSep "\n" (
|
||||
lib.mapAttrsFlatten (k: v: "alias ${k} ${lib.escapeShellArg v}")
|
||||
lib.mapAttrsToList (k: v: "alias ${k} ${lib.escapeShellArg v}")
|
||||
(lib.filterAttrs (k: v: v != null) cfg.shellAliases)
|
||||
);
|
||||
|
||||
|
@ -10,7 +10,7 @@ let
|
||||
opt = options.programs.zsh;
|
||||
|
||||
zshAliases = builtins.concatStringsSep "\n" (
|
||||
lib.mapAttrsFlatten (k: v: "alias -- ${k}=${lib.escapeShellArg v}")
|
||||
lib.mapAttrsToList (k: v: "alias -- ${k}=${lib.escapeShellArg v}")
|
||||
(lib.filterAttrs (k: v: v != null) cfg.shellAliases)
|
||||
);
|
||||
|
||||
|
@ -223,7 +223,7 @@ in
|
||||
|
||||
config = mkIf (cfg.servers != { }) {
|
||||
|
||||
systemd.services = (listToAttrs (mapAttrsFlatten (name: value: nameValuePair "openvpn-${name}" (makeOpenVPNJob value name)) cfg.servers))
|
||||
systemd.services = (listToAttrs (mapAttrsToList (name: value: nameValuePair "openvpn-${name}" (makeOpenVPNJob value name)) cfg.servers))
|
||||
// restartService;
|
||||
|
||||
environment.systemPackages = [ openvpn ];
|
||||
|
Loading…
Reference in New Issue
Block a user