diff --git a/home/wm/i3.nix b/home/wm/i3.nix index 14ec64e..f8080ad 100644 --- a/home/wm/i3.nix +++ b/home/wm/i3.nix @@ -154,7 +154,7 @@ in }; # I don't care for i3's default values, I specify them all explicitly - keybindings = builtins.foldl' (lhs: rhs: lhs // rhs) { } [ + keybindings = lib.my.recursiveMerge [ { # The basics "${modifier}+Return" = "exec ${terminal}"; @@ -298,7 +298,7 @@ in in lib.my.genAttrs' oneToNine createWorkspaceBinding; in - builtins.foldl' (lhs: rhs: lhs // rhs) { } [ + lib.my.recursiveMerge [ (createWorkspaceBindings modifier "workspace number") (createWorkspaceBindings "${modifier}+Shift" "move container to workspace number") { diff --git a/lib/attrs.nix b/lib/attrs.nix index 84b63c7..75114b2 100644 --- a/lib/attrs.nix +++ b/lib/attrs.nix @@ -1,6 +1,13 @@ { lib, ... }: let - inherit (lib) filterAttrs listToAttrs mapAttrs' nameValuePair; + inherit (lib) + filterAttrs + foldl + listToAttrs + mapAttrs' + nameValuePair + recursiveUpdate + ; in { # Filter a generated set of attrs using a predicate function. @@ -19,6 +26,13 @@ in # attrs genAttrs' = values: f: listToAttrs (map f values); + # Merge a list of attrs recursively, later values override previous ones. + # + # recursiveMerge :: + # [ attrs ] + # attrs + recursiveMerge = foldl recursiveUpdate { }; + # Rename each of the attributes in an attribute set using the mapping function # # renameAttrs :: diff --git a/modules/services/nginx.nix b/modules/services/nginx.nix index e7ab566..a68c8b9 100644 --- a/modules/services/nginx.nix +++ b/modules/services/nginx.nix @@ -173,7 +173,7 @@ in domain = config.networking.domain; mkVHost = ({ subdomain, ... } @ args: lib.nameValuePair "${subdomain}.${domain}" - (builtins.foldl' lib.recursiveUpdate { } [ + (lib.my.recursiveMerge [ # Base configuration { forceSSL = true; diff --git a/modules/system/users.nix b/modules/system/users.nix index 3897ad7..32b46ca 100644 --- a/modules/system/users.nix +++ b/modules/system/users.nix @@ -17,11 +17,11 @@ in users = { root = { - inherit (secrets.users.root) hashedPassword; + initialHashedPassword = secrets.users.root.hashedPassword; }; ${config.my.user.name} = { - inherit (secrets.users.${config.my.user.name}) hashedPassword; + initialHashedPassword = secrets.users.ambroisie.hashedPassword; description = "Bruno BELANYI"; isNormalUser = true; shell = pkgs.zsh;