refactor: centralize SOPS configuration in separate file
All checks were successful
Flake checker / Build Nix targets (push) Successful in 9m29s

This commit is contained in:
uttarayan21
2025-09-03 14:22:01 +05:30
parent 3d2f53e8f5
commit be5b646ece
12 changed files with 39 additions and 30 deletions

View File

@@ -306,6 +306,10 @@
name = device.name; name = device.name;
user = device.user; user = device.user;
is = name: device.name == name; is = name: device.name == name;
home =
if isDarwin
then "/Users/${device.user}"
else "/home/${device.user}";
}; };
nixos_devices = nixpkgs.lib.attrsets.filterAttrs (n: x: x.isNix) devices; nixos_devices = nixpkgs.lib.attrsets.filterAttrs (n: x: x.isNix) devices;
@@ -373,6 +377,7 @@
overlays = import ./overlays.nix { overlays = import ./overlays.nix {
inherit inputs; inherit inputs;
}; };
config.allowUnfree = true;
}; };
in { in {
packages = rec { packages = rec {

View File

@@ -6,7 +6,6 @@
}: { }: {
programs.ssh = { programs.ssh = {
enable = true; enable = true;
enableDefaultConfig = false;
matchBlocks = { matchBlocks = {
tsuba = { tsuba = {
user = "servius"; user = "servius";
@@ -46,13 +45,13 @@
hostname = "steamdeck"; hostname = "steamdeck";
forwardAgent = true; forwardAgent = true;
}; };
"*" = { # "*" = {
forwardAgent = false; # forwardAgent = false;
addKeysToAgent = "no"; # addKeysToAgent = "no";
# compression = true; # # compression = true;
# HashKnownHosts = "no"; # # HashKnownHosts = "no";
serverAliveInterval = 60; # serverAliveInterval = 60;
}; # };
}; };
extraConfig = extraConfig =
lib.strings.optionalString (pkgs.stdenv.isDarwin && !device.isServer) lib.strings.optionalString (pkgs.stdenv.isDarwin && !device.isServer)
@@ -63,4 +62,7 @@
IdentityAgent ~/.1password/agent.sock IdentityAgent ~/.1password/agent.sock
''; '';
}; };
# // lib.mkIf (!(device.is "tsuba")) {
# enableDefaultConfig = false;
# };
} }

View File

@@ -20,7 +20,6 @@
inputs.sops-nix.nixosModules.sops inputs.sops-nix.nixosModules.sops
inputs.disko.nixosModules.disko inputs.disko.nixosModules.disko
{nixpkgs.overlays = overlays;} {nixpkgs.overlays = overlays;}
./${device.name}/configuration.nix
home-manager.nixosModules.home-manager home-manager.nixosModules.home-manager
inputs.arion.nixosModules.arion inputs.arion.nixosModules.arion
# inputs.command-runner.nixosModules.command-runner # inputs.command-runner.nixosModules.command-runner
@@ -43,6 +42,8 @@
]; ];
}; };
} }
../sops.nix
./${device.name}/configuration.nix
]; ];
} }
) )

View File

@@ -24,9 +24,6 @@
security.sudo.wheelNeedsPassword = false; security.sudo.wheelNeedsPassword = false;
sops = { sops = {
defaultSopsFile = ../../secrets/secrets.yaml;
defaultSopsFormat = "yaml";
age.keyFile = "/home/fs0c131y/.config/sops/age/keys.txt";
secrets."builder/mirai/cache/private" = {}; secrets."builder/mirai/cache/private" = {};
secrets.users = { secrets.users = {
sopsFile = ../../secrets/users.yaml; sopsFile = ../../secrets/users.yaml;

View File

@@ -1,7 +1,8 @@
{...}: { {stablePkgs, ...}: {
services = { services = {
flaresolverr = { flaresolverr = {
enable = true; enable = true;
package = stablePkgs.flaresolverr;
}; };
}; };
} }

View File

@@ -43,7 +43,7 @@
}; };
}; };
open-webui = { open-webui = {
enable = true; enable = false;
port = 7070; port = 7070;
environment = { environment = {
SCARF_NO_ANALYTICS = "True"; SCARF_NO_ANALYTICS = "True";

View File

@@ -13,8 +13,8 @@
http_port = 5090; http_port = 5090;
ldap_port = 389; ldap_port = 389;
ldap_host = "::"; ldap_host = "::";
ldap_user_pass_file = config.sops.secrets."lldap/admin".path;
environmentFile = '' environmentFile = ''
LLDAP_LDAP_USER_PASS_FILE = ${config.sops.secrets."lldap/admin".path};
LLDAP_JWT_SECRET_FILE = ${config.sops.secrets."lldap/jwt".path}; LLDAP_JWT_SECRET_FILE = ${config.sops.secrets."lldap/jwt".path};
LLDAP_KEY_SEED_FILE = ${config.sops.secrets."lldap/seed".path}; LLDAP_KEY_SEED_FILE = ${config.sops.secrets."lldap/seed".path};
''; '';

View File

@@ -11,11 +11,11 @@
./containers ./containers
]; ];
sops = { # sops = {
defaultSopsFile = ../../secrets/secrets.yaml; # defaultSopsFile = ../../secrets/secrets.yaml;
defaultSopsFormat = "yaml"; # defaultSopsFormat = "yaml";
age.keyFile = "/home/${device.user}/.config/sops/age/keys.txt"; # age.keyFile = "/home/${device.user}/.config/sops/age/keys.txt";
}; # };
security.tpm2 = { security.tpm2 = {
enable = true; enable = true;

View File

@@ -13,11 +13,6 @@
nixpkgs.config.allowUnfree = true; nixpkgs.config.allowUnfree = true;
security.sudo.wheelNeedsPassword = false; security.sudo.wheelNeedsPassword = false;
sops = {
defaultSopsFile = ../../secrets/secrets.yaml;
defaultSopsFormat = "yaml";
age.keyFile = "/home/servius/.config/sops/age/keys.txt";
};
nix = { nix = {
settings = { settings = {
auto-optimise-store = true; auto-optimise-store = true;

View File

@@ -49,6 +49,7 @@
./services ./services
./disk-config.nix ./disk-config.nix
./${name}.nix ./${name}.nix
../../sops.nix
]; ];
} }
) )

View File

@@ -31,11 +31,11 @@
} }
} }
''; '';
# package = pkgs.caddy.withPlugins { package = pkgs.caddy.withPlugins {
# plugins = ["github.com/caddy-dns/hetzner@v1.0.0"]; plugins = ["github.com/caddy-dns/hetzner@v1.0.0"];
# hash = "sha256-9ea0CfOHG7JhejB73HjfXQpnonn+ZRBqLNz1fFRkcDQ="; hash = "sha256-9ea0CfOHG7JhejB73HjfXQpnonn+ZRBqLNz1fFRkcDQ=";
# }; };
package = pkgs.caddyWithHetzner; # package = pkgs.caddyWithHetzner;
}; };
}; };
systemd.services.caddy = { systemd.services.caddy = {

7
sops.nix Normal file
View File

@@ -0,0 +1,7 @@
{device, ...}: {
sops = {
defaultSopsFile = secrets/secrets.yaml;
defaultSopsFormat = "yaml";
age.keyFile = "${device.home}/.config/sops/age/keys.txt";
};
}