Compare commits

...

5 commits

Author SHA1 Message Date
Bruno BELANYI 2d26b36e31 modules: services: nginx: use 'recursiveMerge'
All checks were successful
continuous-integration/drone/push Build is passing
2021-09-23 22:11:25 +02:00
Bruno BELANYI c93a9e5a98 home: wm: i3: use 'recursiveMerge' 2021-09-23 22:11:25 +02:00
Bruno BELANYI 3fa14ebe71 lib: attrs: add 'recursiveMerge' 2021-09-23 22:11:25 +02:00
Bruno BELANYI bd1a2000fe modules: system: users: use 'initialHashedPassword'
This is the better option to use in case I want to have a stateless
system.
2021-09-23 21:30:24 +02:00
Bruno BELANYI 4a0c10b897 modules: system: users: use 'ambroisie' password
Do not rely on `my.user.name` which could be changed to a value not
available in the secrets.
2021-09-23 21:28:29 +02:00
4 changed files with 20 additions and 6 deletions

View file

@ -154,7 +154,7 @@ in
}; };
# I don't care for i3's default values, I specify them all explicitly # 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 # The basics
"${modifier}+Return" = "exec ${terminal}"; "${modifier}+Return" = "exec ${terminal}";
@ -298,7 +298,7 @@ in
in in
lib.my.genAttrs' oneToNine createWorkspaceBinding; lib.my.genAttrs' oneToNine createWorkspaceBinding;
in in
builtins.foldl' (lhs: rhs: lhs // rhs) { } [ lib.my.recursiveMerge [
(createWorkspaceBindings modifier "workspace number") (createWorkspaceBindings modifier "workspace number")
(createWorkspaceBindings "${modifier}+Shift" "move container to workspace number") (createWorkspaceBindings "${modifier}+Shift" "move container to workspace number")
{ {

View file

@ -1,6 +1,13 @@
{ lib, ... }: { lib, ... }:
let let
inherit (lib) filterAttrs listToAttrs mapAttrs' nameValuePair; inherit (lib)
filterAttrs
foldl
listToAttrs
mapAttrs'
nameValuePair
recursiveUpdate
;
in in
{ {
# Filter a generated set of attrs using a predicate function. # Filter a generated set of attrs using a predicate function.
@ -19,6 +26,13 @@ in
# attrs # attrs
genAttrs' = values: f: listToAttrs (map f values); 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 # Rename each of the attributes in an attribute set using the mapping function
# #
# renameAttrs :: # renameAttrs ::

View file

@ -173,7 +173,7 @@ in
domain = config.networking.domain; domain = config.networking.domain;
mkVHost = ({ subdomain, ... } @ args: lib.nameValuePair mkVHost = ({ subdomain, ... } @ args: lib.nameValuePair
"${subdomain}.${domain}" "${subdomain}.${domain}"
(builtins.foldl' lib.recursiveUpdate { } [ (lib.my.recursiveMerge [
# Base configuration # Base configuration
{ {
forceSSL = true; forceSSL = true;

View file

@ -17,11 +17,11 @@ in
users = { users = {
root = { root = {
inherit (secrets.users.root) hashedPassword; initialHashedPassword = secrets.users.root.hashedPassword;
}; };
${config.my.user.name} = { ${config.my.user.name} = {
inherit (secrets.users.${config.my.user.name}) hashedPassword; initialHashedPassword = secrets.users.ambroisie.hashedPassword;
description = "Bruno BELANYI"; description = "Bruno BELANYI";
isNormalUser = true; isNormalUser = true;
shell = pkgs.zsh; shell = pkgs.zsh;