feat(secrets): auto-add secrets, create path shortcut
This commit is contained in:
parent
44e85b3ee3
commit
56c459e49f
5 changed files with 19 additions and 6 deletions
|
@ -108,6 +108,8 @@
|
||||||
|
|
||||||
inputs.impermanence.nixosModules.impermanence
|
inputs.impermanence.nixosModules.impermanence
|
||||||
inputs.quick-nix-registry.nixosModules.local-registry
|
inputs.quick-nix-registry.nixosModules.local-registry
|
||||||
|
|
||||||
|
./secrets
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,8 @@ in
|
||||||
monitors = mkOpt int 1;
|
monitors = mkOpt int 1;
|
||||||
graphical = mkBoolOpt config.services.xserver.enable;
|
graphical = mkBoolOpt config.services.xserver.enable;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
secrets = mkOpt (attrsOf path) { };
|
||||||
};
|
};
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
|
@ -40,5 +42,7 @@ in
|
||||||
environment.variables = mkAliasDefinitions options.env;
|
environment.variables = mkAliasDefinitions options.env;
|
||||||
|
|
||||||
bud.localFlakeClone = config.dotfiles.dir;
|
bud.localFlakeClone = config.dotfiles.dir;
|
||||||
|
|
||||||
|
secrets = mapAttrs (n: v: v.path) config.age.secrets;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
11
secrets/default.nix
Normal file
11
secrets/default.nix
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
{ lib, self, ... }:
|
||||||
|
let
|
||||||
|
folder = ./.;
|
||||||
|
toFile = name: "${folder}/${name}";
|
||||||
|
filterSecrets = key: value: value == "regular" && lib.hasSuffix ".age" key;
|
||||||
|
filtered = (lib.filterAttrs filterSecrets (builtins.readDir folder));
|
||||||
|
secrets = lib.mapAttrs' (n: v: lib.nameValuePair (lib.removeSuffix ".age" n) { file = toFile n; }) filtered;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
age.secrets = secrets;
|
||||||
|
}
|
|
@ -89,12 +89,10 @@ in
|
||||||
software.minipro.enable = true;
|
software.minipro.enable = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
age.secrets.infinidoge-password.file = "${self}/secrets/infinidoge-password.age";
|
|
||||||
|
|
||||||
user = {
|
user = {
|
||||||
name = "infinidoge";
|
name = "infinidoge";
|
||||||
uid = 1000;
|
uid = 1000;
|
||||||
passwordFile = config.age.secrets.infinidoge-password.path;
|
passwordFile = config.secrets.infinidoge-password;
|
||||||
description = "Infinidoge, primary user of the system";
|
description = "Infinidoge, primary user of the system";
|
||||||
group = "users";
|
group = "users";
|
||||||
isNormalUser = true;
|
isNormalUser = true;
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
{ lib, config, self, ... }: {
|
{ lib, config, self, ... }: {
|
||||||
age.secrets.root-password.file = "${self}/secrets/root-password.age";
|
users.users.root.passwordFile = config.secrets.root-password;
|
||||||
|
|
||||||
users.users.root.passwordFile = config.age.secrets.root-password.path;
|
|
||||||
|
|
||||||
home-manager.users.root = { suites, profiles, ... }: {
|
home-manager.users.root = { suites, profiles, ... }: {
|
||||||
imports = lib.lists.flatten [
|
imports = lib.lists.flatten [
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue