mirror of
https://github.com/SebastianStork/nixos-config.git
synced 2026-01-21 18:41:34 +01:00
Refactor home-manager's defaultSopsFile definition
This commit is contained in:
parent
a401c0f4cf
commit
8ab4f4b9e1
1 changed files with 12 additions and 8 deletions
|
|
@ -5,20 +5,24 @@
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}@moduleArgs:
|
}@moduleArgs:
|
||||||
|
let
|
||||||
|
cfg = config.custom.sops;
|
||||||
|
in
|
||||||
{
|
{
|
||||||
imports = [ inputs.sops-nix.homeManagerModules.sops ];
|
imports = [ inputs.sops-nix.homeManagerModules.sops ];
|
||||||
|
|
||||||
options.custom.sops.enable = lib.mkEnableOption "";
|
options.custom.sops = {
|
||||||
|
enable = lib.mkEnableOption "";
|
||||||
|
hostName = lib.mkOption {
|
||||||
|
type = lib.types.nonEmptyStr;
|
||||||
|
default = moduleArgs.osConfig.networking.hostName or "";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
config = lib.mkIf config.custom.sops.enable {
|
config = lib.mkIf cfg.enable {
|
||||||
sops = {
|
sops = {
|
||||||
age.sshKeyPaths = [ "${config.home.homeDirectory}/.ssh/id_ed25519" ];
|
age.sshKeyPaths = [ "${config.home.homeDirectory}/.ssh/id_ed25519" ];
|
||||||
defaultSopsFile =
|
defaultSopsFile = "${self}/users/${config.home.username}/${cfg.hostName}/secrets.yaml";
|
||||||
let
|
|
||||||
hostName = moduleArgs.osConfig.networking.hostName or "";
|
|
||||||
hostDir = if hostName != "" then "/@" + hostName else "";
|
|
||||||
in
|
|
||||||
"${self}/users/${config.home.username}${hostDir}/secrets.yaml";
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue