Unverified Commit 473e469d authored by Silvan Mosberger's avatar Silvan Mosberger Committed by GitHub
Browse files

Merge pull request #328381 from tie/map-attrs-flatten

parents 6b63e262 b9c51260
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -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) ];
+2 −0
Original line number Diff line number Diff line
@@ -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.
+1 −1
Original line number Diff line number Diff line
@@ -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)
  );

+2 −2
Original line number Diff line number Diff line
@@ -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)
  );

+1 −1
Original line number Diff line number Diff line
@@ -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)
  );

Loading