diff --git a/nixos/configuration.nix b/nixos/configuration.nix index 4b9a178..e5bde26 100644 --- a/nixos/configuration.nix +++ b/nixos/configuration.nix @@ -95,11 +95,15 @@ isNormalUser = true; description = "Aleksandr Lebedev"; extraGroups = [ "networkmanager" "wheel" ]; - #initialPassword = "1234"; - hashedPasswordFile = config.sops.secrets."users/${username}".path; + initialPassword = "1234"; packages = with pkgs; []; }; }; + #test = { + # isNormalUser = true; + # initialPassword = "1234"; + # extraGroups = [ "networkmanager" ]; + #}; }; qt = { diff --git a/nixos/modules/sops/default.nix b/nixos/modules/sops/default.nix index 2cdb98e..479b15e 100644 --- a/nixos/modules/sops/default.nix +++ b/nixos/modules/sops/default.nix @@ -1,9 +1,12 @@ -{ pkgs, inputs, username, hwconfig, ... }: +{ config, pkgs, inputs, username, lib, hwconfig, ... }: +let + keyPath = (if hwconfig.useImpermanence then "/persist/sops/age/keys.txt" else "/var/lib/sops/age/keys.txt"); +in { environment.systemPackages = with pkgs; [sops]; sops.defaultSopsFile = ./secrets/secrets.yaml; sops.defaultSopsFormat = "yaml"; - sops.age.keyFile = (if hwconfig.useImpermanence then "/persist/sops/age/keys.txt" else "/home/${username}/.config/sops/age/keys.txt"); + sops.age.keyFile = keyPath; # This will generate a new key if the key specified above does not exist sops.age.generateKey = true; @@ -12,4 +15,8 @@ neededForUsers = true; }; }; + users.users.${username} = { + hashedPasswordFile = config.sops.secrets."users/${username}".path; + initialPassword = lib.mkForce null; + }; }