nixos/modules: use mapAttrsToList instead of mapAttrsFlatten

This commit is contained in:
Ivan Trubach 2024-07-19 11:32:13 +03:00
parent a13e0a12b7
commit 7919709a23
4 changed files with 5 additions and 5 deletions

View File

@ -10,7 +10,7 @@ let
cfg = config.programs.bash; cfg = config.programs.bash;
bashAliases = builtins.concatStringsSep "\n" ( 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) (lib.filterAttrs (k: v: v != null) cfg.shellAliases)
); );

View File

@ -7,12 +7,12 @@ let
cfg = config.programs.fish; cfg = config.programs.fish;
fishAbbrs = lib.concatStringsSep "\n" ( 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 cfg.shellAbbrs
); );
fishAliases = lib.concatStringsSep "\n" ( 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) (lib.filterAttrs (k: v: v != null) cfg.shellAliases)
); );

View File

@ -10,7 +10,7 @@ let
opt = options.programs.zsh; opt = options.programs.zsh;
zshAliases = builtins.concatStringsSep "\n" ( 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) (lib.filterAttrs (k: v: v != null) cfg.shellAliases)
); );

View File

@ -223,7 +223,7 @@ in
config = mkIf (cfg.servers != { }) { 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; // restartService;
environment.systemPackages = [ openvpn ]; environment.systemPackages = [ openvpn ];