nixos/hosts/common/users/sam/default.nix

44 lines
1.0 KiB
Nix

{ pkgs, inputs, config, lib, ... }:
let
hostname = config.networking.hostName;
pubKeys = lib.filesystem.listFilesRecursive (../keys);
sopsHashedPasswordFile = lib.optionalString (lib.hasAttr "sops-nix" inputs) config.sops.secrets."passwords/sam".path;
secretsDirectory = builtins.toString inputs.nix-secrets;
secretsFile = "${secretsDirectory}/secrets.yaml";
in
{
users.users.sam = {
mutableUsers = true;
isNormalUser = true;
shell = pkgs.zsh; # default shell
initialPassword = "nixos";
hashedPasswordFile = sopsHashedPasswordFile;
openssh.authorizedKeys.keys = lib.lists.forEach pubKeys (key: builtins.readFile key);
extraGroups = [
"wheel"
"docker"
"git"
"networkmanager"
];
};
sops.secrets."passwords/sam" = {
sopsFile = "${secretsFile}";
neededForUsers = true;
};
programs.zsh.enable = true;
home-manager = {
extraSpecialArgs = { inherit inputs; };
users = {
sam = import ../../../../home/${hostname}.nix;
};
};
environment.systemPackages = [
];
}