mirror of
https://github.com/RGBCube/ncc
synced 2025-07-29 02:57:44 +00:00
Use lib.const and fix restic password age file
This commit is contained in:
parent
fefb810d97
commit
4a0d8c4254
16 changed files with 36 additions and 24 deletions
12
flake.nix
12
flake.nix
|
@ -77,11 +77,11 @@
|
|||
(filter (name: !hasPrefix "_" (builtins.baseNameOf name)))
|
||||
];
|
||||
|
||||
lib1 = with lib0; extend (_: _: pipe (collectNixFiles ./lib) [
|
||||
lib1 = with lib0; extend (const (const (pipe (collectNixFiles ./lib) [
|
||||
(map (file: import file lib0))
|
||||
(filter (thunk: !isFunction thunk))
|
||||
(foldl' recursiveUpdate {})
|
||||
]);
|
||||
])));
|
||||
|
||||
nixpkgsOverlayModule = with lib1; {
|
||||
nixpkgs.overlays = [(final: prev: {
|
||||
|
@ -97,7 +97,7 @@
|
|||
};
|
||||
|
||||
homeManagerModule = { lib, ... }: with lib; {
|
||||
home-manager.users = genAttrs allNormalUsers (_: {});
|
||||
home-manager.users = genAttrs allNormalUsers (const {});
|
||||
|
||||
home-manager.useGlobalPkgs = true;
|
||||
home-manager.useUserPackages = true;
|
||||
|
@ -135,12 +135,12 @@
|
|||
|
||||
modules = [ ./hosts/${name} ] ++ optionModules;
|
||||
};
|
||||
in extend (_: _: pipe (collectNixFiles ./lib) [
|
||||
in extend (const (const (pipe (collectNixFiles ./lib) [
|
||||
(map (file: import file lib1))
|
||||
(filter (isFunction))
|
||||
(map (func: func hostStub.config))
|
||||
(foldl' recursiveUpdate {})
|
||||
]));
|
||||
]))));
|
||||
|
||||
configurations = lib1.genAttrs hosts (name: lib2s.${name}.nixosSystem {
|
||||
inherit specialArgs;
|
||||
|
@ -153,5 +153,5 @@
|
|||
nixosConfigurations = configurations;
|
||||
|
||||
# This is here so we can do self.<whatever> instead of self.nixosConfigurations.<whatever>.config.
|
||||
} // lib1.mapAttrs (_: value: value.config) configurations;
|
||||
} // lib1.mapAttrs (lib1.const (value: value.config)) configurations;
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ in systemConfiguration {
|
|||
}];
|
||||
};
|
||||
|
||||
services.restic.backups = genAttrs config.resticHosts (_: {
|
||||
services.restic.backups = genAttrs config.resticHosts (const {
|
||||
paths = [ "/var/lib/gitea-runner" "/var/lib/forgejo" ];
|
||||
});
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ in systemConfiguration {
|
|||
}];
|
||||
};
|
||||
|
||||
services.restic.backups = genAttrs config.resticHosts (_: {
|
||||
services.restic.backups = genAttrs config.resticHosts (const {
|
||||
paths = [ "/var/lib/grafana" ];
|
||||
});
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ in serverSystemConfiguration {
|
|||
];
|
||||
};
|
||||
|
||||
services.restic.backups = genAttrs config.resticHosts (_: {
|
||||
services.restic.backups = genAttrs config.resticHosts (const {
|
||||
paths = [ "/var/lib/matrix-synapse" "/var/lib/matrix-sliding-sync" ];
|
||||
});
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ in systemConfiguration {
|
|||
}];
|
||||
};
|
||||
|
||||
services.restic.backups = genAttrs config.resticHosts (_: {
|
||||
services.restic.backups = genAttrs config.resticHosts (const {
|
||||
paths = [ "/var/lib/nextcloud" ];
|
||||
});
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
runAsLocalSuperUser = true;
|
||||
};
|
||||
|
||||
services.restic.backups = genAttrs config.resticHosts (_: {
|
||||
services.restic.backups = genAttrs config.resticHosts (const {
|
||||
paths = [ "/tmp/postgresql-dump.sql.gz" ];
|
||||
|
||||
backupPrepareCommand = ''
|
||||
|
|
|
@ -22,7 +22,7 @@ systemConfiguration {
|
|||
|
||||
scrapeConfigs = with lib; let
|
||||
configToScrapeConfig = name: { config, ... }: pipe config.services.prometheus.exporters [
|
||||
(filterAttrs (_: value: value.enable or false))
|
||||
(filterAttrs (const (value: value.enable or false)))
|
||||
(mapAttrsToList (expName: expConfig: {
|
||||
job_name = "${expName}-${name}";
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ in systemConfiguration {
|
|||
listenAddress = "[::]";
|
||||
};
|
||||
|
||||
services.restic.backups = genAttrs config.resticHosts (_: {
|
||||
services.restic.backups = genAttrs config.resticHosts (const {
|
||||
paths = [ config.mailserver.dkimKeyDirectory config.mailserver.mailDirectory ];
|
||||
});
|
||||
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
lib: config: let
|
||||
userHomeConfiguration = users: cfg: {
|
||||
home-manager.users = lib.genAttrs users (_: cfg);
|
||||
home-manager.users = lib.genAttrs users (lib.const cfg);
|
||||
};
|
||||
|
||||
allNormalUsers = [ "root" ] ++ lib.pipe config.users.users [
|
||||
(lib.filterAttrs (_: lib.getAttr "isNormalUser"))
|
||||
(lib.filterAttrs (lib.const (lib.getAttr "isNormalUser")))
|
||||
lib.attrNames
|
||||
];
|
||||
|
||||
desktopUsers = lib.pipe config.users.users [
|
||||
(lib.filterAttrs (_: lib.getAttr "isDesktopUser"))
|
||||
(lib.filterAttrs (lib.const (lib.getAttr "isDesktopUser")))
|
||||
lib.attrNames
|
||||
];
|
||||
in rec {
|
||||
|
|
|
@ -159,7 +159,7 @@
|
|||
render.tab = "all";
|
||||
};
|
||||
|
||||
settings.keys = genAttrs [ "normal" "select" ] (_: {
|
||||
settings.keys = genAttrs [ "normal" "select" ] (const {
|
||||
D = "extend_to_line_end";
|
||||
});
|
||||
};
|
||||
|
|
|
@ -42,7 +42,7 @@ desktopUserHomeConfiguration {
|
|||
inner-pad = padding;
|
||||
};
|
||||
|
||||
settings.colors = mapAttrs (_: color: color + "FF") {
|
||||
settings.colors = mapAttrs (const (color: color + "FF")) {
|
||||
background = base00;
|
||||
text = base05;
|
||||
match = base0A;
|
||||
|
|
|
@ -25,5 +25,5 @@
|
|||
"LC_PAPER"
|
||||
"LC_TELEPHONE"
|
||||
"LC_TIME"
|
||||
] (_: "tr_TR.UTF-8");
|
||||
] (const "tr_TR.UTF-8");
|
||||
})
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
registry = {
|
||||
default.flake = inputs.nixpkgs;
|
||||
} // mapAttrs (_: value: mkIf (isType "flake" value) {
|
||||
} // mapAttrs (const (value: mkIf (isType "flake" value)) {
|
||||
flake = value;
|
||||
}) inputs;
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
configFile.text = readFile ./configuration.nu;
|
||||
envFile.source = ./environment.nu;
|
||||
|
||||
environmentVariables = mapAttrs (_: value: ''"${value}"'') config.environment.variables;
|
||||
environmentVariables = mapAttrs (const (value: ''"${value}"'')) config.environment.variables;
|
||||
|
||||
shellAliases = (attrsets.removeAttrs config.environment.shellAliases [ "ls" "l" ]) // {
|
||||
cdtmp = "cd (mktemp --directory)";
|
||||
|
|
13
modules/restic/password.age
Normal file
13
modules/restic/password.age
Normal file
|
@ -0,0 +1,13 @@
|
|||
age-encryption.org/v1
|
||||
-> ssh-ed25519 +rZ0Tw Em0WbO4gplG2ja+XW889tC0EGeuc8Mv3IfOWvwN0QXE
|
||||
5zIOO6qXiBcOOPe00D5hWMaQiA8pM6zmsWxV2wubNJE
|
||||
-> ssh-ed25519 spFFQA Dp3QVWKHnrPnJXQ3n9t6PzDLuulZu98CZDm25WZaJgA
|
||||
4PexDQzjTEA3KQ2oo+2lC8cHdYp8iOc5ilKrnf54uOU
|
||||
-> ssh-ed25519 CzqbPQ Ove5RO0REKpcyDrcihPYFqAxO0ynvK9MIJhM2BX8v1A
|
||||
KyIbllnvM+Eiir2wsMp1mdkyjbKPcsCQy8tNLoF+CNA
|
||||
-> ssh-ed25519 dASlBQ P3eVN6O2MfcSzdIlV6z7ALBtKC0HhtW296qDIjtayEk
|
||||
+drcAG52h0dzmp45woWadyNlUqaY156XaGEeq5AR0JM
|
||||
-> ssh-ed25519 f5VzMA 4e4M6qzgt1qiZp2DJrd9Jk5wDEVBB8Gac31litJ62Ug
|
||||
QretaVV5MLi5qwt18eQyDCJiTvicV/VAvvImfx1//FI
|
||||
--- 5AqRIM2qsjiMytT70BtR7JS/XRNj5U7mpzSu6mjmmrY
|
||||
}ÅM<C385> }€K6ÓÝÐå¸ëaG„sâ’ž¨¥ßÿBá$¿âiÑ[Õ¶Ã@LoIÉL
|
|
@ -14,8 +14,6 @@ with import ./keys.nix; {
|
|||
|
||||
"hosts/cube/nextcloud/password.age".publicKeys = [ cube ] ++ admins;
|
||||
|
||||
"hosts/cube/restic/password.age".publicKeys = [ cube ] ++ admins;
|
||||
|
||||
# disk
|
||||
"hosts/disk/id.age".publicKeys = [ disk ] ++ admins;
|
||||
"hosts/disk/password.floppy.age".publicKeys = [ disk ] ++ admins;
|
||||
|
@ -33,5 +31,6 @@ with import ./keys.nix; {
|
|||
"hosts/nine/password.seven.age".publicKeys = [ nine ] ++ admins;
|
||||
|
||||
# shared
|
||||
"modules/ssh/config.age".publicKeys = all;
|
||||
"modules/ssh/config.age".publicKeys = all;
|
||||
"modules/restic/password.age".publicKeys = all;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue