♻️ [shared] Moved files to base shared directory
This commit is contained in:
8
shared/base/modules/security/default.nix
Normal file
8
shared/base/modules/security/default.nix
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
imports = [
|
||||
./sops.nix
|
||||
./ssh.nix
|
||||
];
|
||||
|
||||
programs.gnupg.agent.enable = true;
|
||||
}
|
20
shared/base/modules/security/sops.nix
Normal file
20
shared/base/modules/security/sops.nix
Normal file
@ -0,0 +1,20 @@
|
||||
{
|
||||
inputs,
|
||||
lib,
|
||||
systemConfig,
|
||||
...
|
||||
}:
|
||||
|
||||
{
|
||||
imports = [
|
||||
inputs.sops-nix.nixosModules.sops
|
||||
];
|
||||
|
||||
sops = {
|
||||
defaultSopsFile = lib.custom.relativeToRoot "shared/secrets/secrets.yaml";
|
||||
defaultSopsFormat = "yaml";
|
||||
|
||||
age.keyFile = "/home/${systemConfig.username}/.config/sops/age/keys.txt";
|
||||
secrets.password-hash.neededForUsers = true;
|
||||
};
|
||||
}
|
27
shared/base/modules/security/ssh.nix
Normal file
27
shared/base/modules/security/ssh.nix
Normal file
@ -0,0 +1,27 @@
|
||||
# /nix/store/<hash>/etc/ssh/ssh_config & /nix/store/<hash>/etc/ssh/authorized_keys
|
||||
{
|
||||
systemConfig,
|
||||
systems,
|
||||
common,
|
||||
...
|
||||
}:
|
||||
with builtins;
|
||||
let
|
||||
domain = "dns.${common.domain}";
|
||||
in
|
||||
{
|
||||
programs.ssh.knownHosts = listToAttrs (
|
||||
map (system: {
|
||||
name = system.hostName;
|
||||
value = {
|
||||
extraHostNames = [
|
||||
"${system.hostName}.${domain}"
|
||||
];
|
||||
publicKey = system.ssh.publicKey;
|
||||
};
|
||||
}) systems
|
||||
);
|
||||
users.users.${systemConfig.username}.openssh.authorizedKeys.keys = (
|
||||
map (system: system.ssh.publicKey) systems
|
||||
);
|
||||
}
|
Reference in New Issue
Block a user