diff --git a/modules/home/sops.nix b/modules/home/sops.nix index 70041b4..f32118a 100644 --- a/modules/home/sops.nix +++ b/modules/home/sops.nix @@ -7,36 +7,35 @@ }@moduleArgs: let cfg = config.custom.sops; - - absoluteSecretsPath = "${self}/${cfg.secretsFile}"; in { imports = [ inputs.sops.homeManagerModules.sops ]; options.custom.sops = { enable = lib.mkEnableOption ""; - agePublicKey = lib.mkOption { - type = lib.types.nonEmptyStr; - default = ""; - }; hostName = lib.mkOption { type = lib.types.nonEmptyStr; default = moduleArgs.osConfig.networking.hostName or ""; }; - secretsFile = lib.mkOption { + agePublicKey = lib.mkOption { type = lib.types.nonEmptyStr; - default = "users/${config.home.username}/@${cfg.hostName}/secrets.json"; + default = + "${self}/users/${config.home.username}/@${cfg.hostName}/keys/age.pub" |> lib.readFile |> lib.trim; + }; + secretsFile = lib.mkOption { + type = lib.types.path; + default = "${self}/users/${config.home.username}/@${cfg.hostName}/secrets.json"; }; secrets = lib.mkOption { type = lib.types.anything; - default = absoluteSecretsPath |> lib.readFile |> lib.strings.fromJSON; + default = cfg.secretsFile |> lib.readFile |> lib.strings.fromJSON; }; }; config = lib.mkIf cfg.enable { sops = { age.sshKeyPaths = [ "${config.home.homeDirectory}/.ssh/id_ed25519" ]; - defaultSopsFile = absoluteSecretsPath; + defaultSopsFile = cfg.secretsFile; }; }; } diff --git a/users/seb/@desktop/home.nix b/users/seb/@desktop/home.nix index 7b41368..119558b 100644 --- a/users/seb/@desktop/home.nix +++ b/users/seb/@desktop/home.nix @@ -3,10 +3,7 @@ _: { home.stateVersion = "23.11"; - custom = { - sops.agePublicKey = "age1p32cyzakxtcx346ej82ftln4r2aw2pcuazq3583s85nzsan4ygqsj32hjf"; - theme = "dark"; - }; + custom.theme = "dark"; wayland.windowManager.hyprland.settings.monitor = [ "DP-1,2560x1440@180,0x0,1" ]; } diff --git a/users/seb/@desktop/keys/age.pub b/users/seb/@desktop/keys/age.pub new file mode 100644 index 0000000..3b5283c --- /dev/null +++ b/users/seb/@desktop/keys/age.pub @@ -0,0 +1 @@ +age1p32cyzakxtcx346ej82ftln4r2aw2pcuazq3583s85nzsan4ygqsj32hjf diff --git a/users/seb/@laptop/home.nix b/users/seb/@laptop/home.nix index 15b5a98..35b3589 100644 --- a/users/seb/@laptop/home.nix +++ b/users/seb/@laptop/home.nix @@ -4,7 +4,6 @@ _: { home.stateVersion = "24.11"; custom = { - sops.agePublicKey = "age190mf9wx4ct7qvne3ly9j3cj9740z5wnfhsl6vsc5wtfyc5pueuas9hnjtr"; theme = "light"; programs.brightnessctl.enable = true; }; diff --git a/users/seb/@laptop/keys/age.pub b/users/seb/@laptop/keys/age.pub new file mode 100644 index 0000000..cd30470 --- /dev/null +++ b/users/seb/@laptop/keys/age.pub @@ -0,0 +1 @@ +age190mf9wx4ct7qvne3ly9j3cj9740z5wnfhsl6vsc5wtfyc5pueuas9hnjtr