Add custom impermanence module

Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
This commit is contained in:
2024-08-08 22:03:15 +03:00
parent 5e57d63a54
commit 22e0150a65
69 changed files with 777 additions and 494 deletions

View File

@@ -1,24 +1,18 @@
{
username ? throw "username argument is required",
user ? throw "user argument is required",
home ? throw "home argument is required",
}:
{ config, inputs, ... }:
{
config,
inputs,
lib,
...
}:
let
userConfig = config.users.users.${username};
hmConfig = config.home-manager.users.${username};
sopsKeyPath = "${hmConfig.xdg.relativeConfigHome}/sops-nix/key.txt";
in
{
environment.persistence."/persist".users.${username}.files = [ sopsKeyPath ];
environment.persistence."/persist"."${home}/.config/sops-nix/key.txt" = { };
home-manager.users.${username} = {
home-manager.users.${user} = {
imports = [ inputs.sops-nix.homeManagerModules.sops ];
sops.age.keyFile = "${userConfig.home}/${sopsKeyPath}";
home.sessionVariables.SOPS_AGE_KEY_FILE = "${userConfig.home}/${sopsKeyPath}";
sops.age.keyFile = "${home}/.config/sops-nix/key.txt";
home.sessionVariables.SOPS_AGE_KEY_FILE = "${home}/.config/sops-nix/key.txt";
systemd.user.services.sops-nix.Unit.After = [
config.environment.persistence."/persist"."${home}/.config/sops-nix/key.txt".mount
];
};
}