bos55-nix-config-cicd/users/deploy/default.nix
Tibo De Peuter ccfa328771
Some checks failed
Build / build (Development) (push) Has been cancelled
Build / Determining hosts to build (push) Failing after 13m25s
Build / build (Testing) (push) Has been cancelled
refactor(security): migrate hardcoded credentials and SSH keys to sops-nix
2026-03-17 21:45:56 +01:00

49 lines
1.1 KiB
Nix

{ config, lib, pkgs, ... }:
let
cfg = config.homelab.users.deploy;
in {
options.homelab.users.deploy.enable = lib.mkEnableOption "user Deploy";
config = lib.mkIf cfg.enable {
users = {
groups.deploy = { };
# The user used to deploy rebuilds without password authentication
users.deploy = {
group = config.users.groups.deploy.name;
isSystemUser = true;
home = "/var/empty";
shell = pkgs.bashInteractive;
openssh.authorizedKeys.keyFiles = [
config.sops.secrets.user_keys_deploy.path
];
};
};
security.sudo.extraRules = [
{
groups = [
config.users.groups.deploy.name
];
commands = [
{
command = "/nix/store/*-nix-*/bin/nix-env -p /nix/var/nix/profile/system --set /nix/store/*-*";
options = [ "NOPASSWD" ];
}
];
}
{
groups = [
config.users.groups.deploy.name
];
commands = [
{
command = "/nix/store/*/bin/switch-to-configuration";
options = [ "NOPASSWD" ];
}
];
}
];
};
}