Compare commits

..

5 Commits

Author SHA1 Message Date
bef474ed78 hosts/dunamis/nix.nix: sync nix
hosts/eldrid/nix.nix: sync nix
hosts/sarien/nix.nix: sync nix

Signed-off-by: unexplrd <unexplrd@linerds.us>
2025-04-06 13:54:47 +03:00
85f1c4b917 hosts/dunamis/programs.nix: sync programs
hosts/eldrid/configuration.nix: sync programs
hosts/sarien/configuration.nix: sync programs

Signed-off-by: unexplrd <unexplrd@linerds.us>
2025-04-06 13:54:47 +03:00
b5ed7d822e hosts/dunamis/sops.nix: add hostname workaround
hosts/eldrid/sops.nix: add hostname workaround
hosts/sarien/sops.nix: add hostname workaround

Signed-off-by: unexplrd <unexplrd@linerds.us>
2025-04-06 13:54:47 +03:00
1f0bbc9daf sync sops and users
Signed-off-by: unexplrd <unexplrd@linerds.us>
2025-04-06 13:54:47 +03:00
d5521a468d flake.lock: update secrets
hosts/dunamis/users.nix: update secrets
hosts/sarien/users.nix: update secrets

Signed-off-by: unexplrd <unexplrd@linerds.us>
2025-04-06 13:54:47 +03:00
13 changed files with 110 additions and 97 deletions

8
flake.lock generated
View File

@ -1120,11 +1120,11 @@
"mysecrets": { "mysecrets": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1743273192, "lastModified": 1743935322,
"narHash": "sha256-G9VhIc+Fc+w4LDR81xmkj3xxbrvYJUOTM9sM4191ucY=", "narHash": "sha256-x/yc+PK6q8mE1iWh43GRBfN0CfLL2RH4fDHvmQwcVRo=",
"ref": "refs/heads/main", "ref": "refs/heads/main",
"rev": "e8f749354223905785f4510fde10b528bf1b2ba2", "rev": "44bde2e703b87c91862d9273c57f8122a6b408b3",
"revCount": 13, "revCount": 14,
"type": "git", "type": "git",
"url": "ssh://gitea@gitea.linerds.us/unexplrd/nix-secrets" "url": "ssh://gitea@gitea.linerds.us/unexplrd/nix-secrets"
}, },

View File

@ -2,12 +2,14 @@
{ {
config, config,
inputs, inputs,
# pkgs,
... ...
}: { }: {
imports = with inputs; [ imports = with inputs; [
lix.nixosModules.default determinate.nixosModules.default
]; ];
nix = { nix = {
# package = pkgs.lix;
channel.enable = false; channel.enable = false;
settings.experimental-features = ["nix-command" "flakes"]; settings.experimental-features = ["nix-command" "flakes"];
daemonCPUSchedPolicy = "idle"; daemonCPUSchedPolicy = "idle";

View File

@ -7,8 +7,6 @@
fish.enable = true; fish.enable = true;
nh = { nh = {
enable = true; enable = true;
clean.enable = true;
clean.extraArgs = "--keep-since 7d --keep 3";
flake = "/home/user/.config/nixos"; flake = "/home/user/.config/nixos";
}; };
}; };

View File

@ -3,9 +3,17 @@
inputs, inputs,
... ...
}: let }: let
s = inputs.mysecrets; inherit (inputs) mysecrets;
hostname = config.networking.hostName; hostName =
sopsFile = "${s}/hosts/${hostname}.yaml"; if (config.networking.hostName == "vylxae")
then "sarien"
else config.networking.hostName;
sopsFile = mysecrets + "/hosts/${hostName}.yaml";
dotSsh = name: "/home/user/.ssh/" + name;
sshKey = {
mode = "0400";
owner = "user";
};
in { in {
imports = with inputs; [ imports = with inputs; [
sops-nix.nixosModules.sops sops-nix.nixosModules.sops
@ -17,45 +25,39 @@ in {
keyFile = "/var/lib/sops-nix/key.txt"; keyFile = "/var/lib/sops-nix/key.txt";
generateKey = true; generateKey = true;
}; };
defaultSopsFile = "${s}/common.yaml"; defaultSopsFile = mysecrets + "/common.yaml";
secrets = { secrets = {
"user-password-hashed".neededForUsers = true; "user-password-hashed".neededForUsers = true;
"ssh-config" = { "ssh-config" = {
path = "/home/user/.ssh/config"; path = dotSsh "config";
mode = "0400"; mode = "0400";
owner = "user"; owner = "user";
}; };
"ssh-${hostname}-user" = { "ssh-${hostName}-user" = {
inherit sopsFile; inherit sopsFile;
path = "/home/user/.ssh/id_ed25519"; inherit (sshKey) mode owner;
mode = "0400"; path = dotSsh "id_ed25519";
owner = "user";
}; };
"ssh-${hostname}-user.pub" = { "ssh-${hostName}-user.pub" = {
inherit sopsFile; inherit sopsFile;
path = "/home/user/.ssh/id_ed25519.pub"; inherit (sshKey) mode owner;
mode = "0400"; path = dotSsh "id_ed25519.pub";
owner = "user";
}; };
"ssh-unexplrd" = { "ssh-unexplrd" = {
path = "/home/user/.ssh/id_unexplrd_ed25519"; inherit (sshKey) mode owner;
mode = "0400"; path = dotSsh "id_unexplrd_ed25519";
owner = "user";
}; };
"ssh-unexplrd.pub" = { "ssh-unexplrd.pub" = {
path = "/home/user/.ssh/id_unexplrd_ed25519.pub"; inherit (sshKey) mode owner;
mode = "0400"; path = dotSsh "id_unexplrd_ed25519.pub";
owner = "user";
}; };
"ssh-uni" = { "ssh-uni" = {
path = "/home/user/.ssh/id_uni_ed25519"; inherit (sshKey) mode owner;
mode = "0400"; path = dotSsh "id_uni_ed25519";
owner = "user";
}; };
"ssh-uni.pub" = { "ssh-uni.pub" = {
path = "/home/user/.ssh/id_uni_ed25519.pub"; inherit (sshKey) mode owner;
mode = "0400"; path = dotSsh "id_uni_ed25519.pub";
owner = "user";
}; };
}; };
}; };

View File

@ -4,20 +4,21 @@
pkgs, pkgs,
... ...
}: let }: let
sopSec = config.sops.secrets; inherit (config.sops) secrets;
s = inputs.mysecrets; inherit (inputs) mysecrets;
in { in {
nix.settings.trusted-users = ["user" "nix-ssh"]; nix.settings.trusted-users = ["user" "nix-ssh"];
users.mutableUsers = false; users.mutableUsers = false;
users.users = { users.users = {
user = { user = {
hashedPasswordFile = sopSec."user-password-hashed".path; hashedPasswordFile = secrets."user-password-hashed".path;
extraGroups = ["wheel" "video" "libvirtd" "dialout"]; extraGroups = ["wheel" "video" "libvirtd" "dialout"];
isNormalUser = true; isNormalUser = true;
shell = pkgs.fish; shell = pkgs.fish;
openssh.authorizedKeys.keyFiles = map (f: s + "/ssh/" + f) [ openssh.authorizedKeys.keyFiles = map (f: "${mysecrets}/ssh/user/${f}") [
"id_ed25519_sarien_user.pub" "id_dunamis_ed25519.pub"
"id_ed25519_eldrid_user.pub" "id_eldrid_ed25519.pub"
"id_sarien_ed25519.pub"
]; ];
}; };
}; };

View File

@ -8,7 +8,7 @@
./networking.nix ./networking.nix
./nix.nix ./nix.nix
./power-saving.nix ./power-saving.nix
./programs.nix ../dunamis/programs.nix
./services.nix ./services.nix
./sops.nix ./sops.nix
./users.nix ./users.nix

View File

@ -1,12 +1,18 @@
# TODO: better file name
{ {
config, config,
inputs, inputs,
# pkgs,
... ...
}: { }: let
inherit (config.sops) secrets;
inherit (inputs) mysecrets;
in {
imports = with inputs; [ imports = with inputs; [
lix.nixosModules.default determinate.nixosModules.default
]; ];
nix = { nix = {
# package = pkgs.lix;
channel.enable = false; channel.enable = false;
daemonCPUSchedPolicy = "idle"; daemonCPUSchedPolicy = "idle";
settings = { settings = {
@ -19,9 +25,9 @@
hostName = "dunamis"; hostName = "dunamis";
sshUser = "nix-ssh"; sshUser = "nix-ssh";
system = "x86_64-linux"; system = "x86_64-linux";
sshKey = config.sops.secrets."ssh-eldrid-user".path; sshKey = secrets."ssh-eldrid-user".path;
supportedFeatures = ["nixos-test" "big-parallel" "kvm" "benchmark"]; supportedFeatures = ["nixos-test" "big-parallel" "kvm" "benchmark"];
publicHostKey = builtins.readFile "${inputs.mysecrets}/ssh/ssh_host_ed25519_dunamis.base64"; publicHostKey = builtins.readFile "${mysecrets}/ssh/ssh_host_ed25519_dunamis.base64";
} }
]; ];
}; };

View File

@ -3,9 +3,17 @@
inputs, inputs,
... ...
}: let }: let
s = inputs.mysecrets; inherit (inputs) mysecrets;
hostname = config.networking.hostName; hostName =
sopsFile = "${s}/hosts/${hostname}.yaml"; if (config.networking.hostName == "vylxae")
then "sarien"
else config.networking.hostName;
sopsFile = mysecrets + "/hosts/${hostName}.yaml";
dotSsh = name: "/home/user/.ssh/" + name;
sshKey = {
mode = "0400";
owner = "user";
};
in { in {
imports = with inputs; [ imports = with inputs; [
sops-nix.nixosModules.sops sops-nix.nixosModules.sops
@ -17,45 +25,39 @@ in {
keyFile = "/var/lib/sops-nix/key.txt"; keyFile = "/var/lib/sops-nix/key.txt";
generateKey = true; generateKey = true;
}; };
defaultSopsFile = "${s}/common.yaml"; defaultSopsFile = mysecrets + "/common.yaml";
secrets = { secrets = {
"user-password-hashed".neededForUsers = true; "user-password-hashed".neededForUsers = true;
"ssh-config" = { "ssh-config" = {
path = "/home/user/.ssh/config"; path = dotSsh "config";
mode = "0400"; mode = "0400";
owner = "user"; owner = "user";
}; };
"ssh-${hostname}-user" = { "ssh-${hostName}-user" = {
inherit sopsFile; inherit sopsFile;
path = "/home/user/.ssh/id_ed25519"; inherit (sshKey) mode owner;
mode = "0400"; path = dotSsh "id_ed25519";
owner = "user";
}; };
"ssh-${hostname}-user.pub" = { "ssh-${hostName}-user.pub" = {
inherit sopsFile; inherit sopsFile;
path = "/home/user/.ssh/id_ed25519.pub"; inherit (sshKey) mode owner;
mode = "0400"; path = dotSsh "id_ed25519.pub";
owner = "user";
}; };
"ssh-unexplrd" = { "ssh-unexplrd" = {
path = "/home/user/.ssh/id_unexplrd_ed25519"; inherit (sshKey) mode owner;
mode = "0400"; path = dotSsh "id_unexplrd_ed25519";
owner = "user";
}; };
"ssh-unexplrd.pub" = { "ssh-unexplrd.pub" = {
path = "/home/user/.ssh/id_unexplrd_ed25519.pub"; inherit (sshKey) mode owner;
mode = "0400"; path = dotSsh "id_unexplrd_ed25519.pub";
owner = "user";
}; };
"ssh-uni" = { "ssh-uni" = {
path = "/home/user/.ssh/id_uni_ed25519"; inherit (sshKey) mode owner;
mode = "0400"; path = dotSsh "id_uni_ed25519";
owner = "user";
}; };
"ssh-uni.pub" = { "ssh-uni.pub" = {
path = "/home/user/.ssh/id_uni_ed25519.pub"; inherit (sshKey) mode owner;
mode = "0400"; path = dotSsh "id_uni_ed25519.pub";
owner = "user";
}; };
}; };
}; };

View File

@ -4,27 +4,22 @@
pkgs, pkgs,
... ...
}: let }: let
sopSec = config.sops.secrets; inherit (config.sops) secrets;
secrets = inputs.mysecrets; inherit (inputs) mysecrets;
in { in {
nix.settings.trusted-users = ["user"]; nix.settings.trusted-users = ["user"];
users.mutableUsers = false; users.mutableUsers = false;
users.users = { users.users = {
user = { user = {
hashedPasswordFile = sopSec."user-password-hashed".path; hashedPasswordFile = secrets."user-password-hashed".path;
# passwordFile = config.sops.secrets.user-password.path;
isNormalUser = true;
extraGroups = ["wheel" "video" "libvirtd" "dialout"]; extraGroups = ["wheel" "video" "libvirtd" "dialout"];
isNormalUser = true;
shell = pkgs.fish; shell = pkgs.fish;
openssh.authorizedKeys.keyFiles = [ openssh.authorizedKeys.keyFiles = map (f: "${mysecrets}/ssh/user/${f}") [
"${secrets}/ssh/id_ed25519_sarien_user.pub" "id_dunamis_ed25519.pub"
"${secrets}/ssh/id_ed25519_eldrid_user.pub" "id_eldrid_ed25519.pub"
"id_sarien_ed25519.pub"
]; ];
}; };
# work = {
# isNormalUser = true;
# extraGroups = ["video"];
# shell = pkgs.nushell;
# };
}; };
} }

View File

@ -8,7 +8,7 @@
./networking.nix ./networking.nix
./nix.nix ./nix.nix
./power-saving.nix ./power-saving.nix
./programs.nix ../dunamis/programs.nix
./services.nix ./services.nix
./sops.nix ./sops.nix
./users.nix ./users.nix

View File

@ -1,9 +1,13 @@
# TODO: better file name
{ {
config, config,
inputs, inputs,
pkgs, # pkgs,
... ...
}: { }: let
inherit (config.sops) secrets;
inherit (inputs) mysecrets;
in {
imports = with inputs; [ imports = with inputs; [
determinate.nixosModules.default determinate.nixosModules.default
]; ];
@ -21,9 +25,9 @@
hostName = "dunamis"; hostName = "dunamis";
sshUser = "nix-ssh"; sshUser = "nix-ssh";
system = "x86_64-linux"; system = "x86_64-linux";
sshKey = config.sops.secrets."ssh-sarien-user".path; sshKey = secrets."ssh-eldrid-user".path;
supportedFeatures = ["nixos-test" "big-parallel" "kvm" "benchmark"]; supportedFeatures = ["nixos-test" "big-parallel" "kvm" "benchmark"];
publicHostKey = builtins.readFile "${inputs.mysecrets}/ssh/ssh_host_ed25519_dunamis.base64"; publicHostKey = builtins.readFile "${mysecrets}/ssh/ssh_host_ed25519_dunamis.base64";
} }
]; ];
}; };

View File

@ -4,9 +4,11 @@
... ...
}: let }: let
inherit (inputs) mysecrets; inherit (inputs) mysecrets;
# TODO: stop relying on networking.hostName hostName =
hostname = "sarien"; if (config.networking.hostName == "vylxae")
sopsFile = mysecrets + "/hosts/${hostname}.yaml"; then "sarien"
else config.networking.hostName;
sopsFile = mysecrets + "/hosts/${hostName}.yaml";
dotSsh = name: "/home/user/.ssh/" + name; dotSsh = name: "/home/user/.ssh/" + name;
sshKey = { sshKey = {
mode = "0400"; mode = "0400";
@ -31,12 +33,12 @@ in {
mode = "0400"; mode = "0400";
owner = "user"; owner = "user";
}; };
"ssh-${hostname}-user" = { "ssh-${hostName}-user" = {
inherit sopsFile; inherit sopsFile;
inherit (sshKey) mode owner; inherit (sshKey) mode owner;
path = dotSsh "id_ed25519"; path = dotSsh "id_ed25519";
}; };
"ssh-${hostname}-user.pub" = { "ssh-${hostName}-user.pub" = {
inherit sopsFile; inherit sopsFile;
inherit (sshKey) mode owner; inherit (sshKey) mode owner;
path = dotSsh "id_ed25519.pub"; path = dotSsh "id_ed25519.pub";

View File

@ -4,20 +4,21 @@
pkgs, pkgs,
... ...
}: let }: let
sopSec = config.sops.secrets; inherit (config.sops) secrets;
secrets = inputs.mysecrets; inherit (inputs) mysecrets;
in { in {
nix.settings.trusted-users = ["user"]; nix.settings.trusted-users = ["user"];
users.mutableUsers = false; users.mutableUsers = false;
users.users = { users.users = {
user = { user = {
hashedPasswordFile = sopSec."user-password-hashed".path; hashedPasswordFile = secrets."user-password-hashed".path;
isNormalUser = true; isNormalUser = true;
extraGroups = ["wheel" "video" "libvirtd" "dialout"]; extraGroups = ["wheel" "video" "libvirtd" "dialout"];
shell = pkgs.fish; shell = pkgs.fish;
openssh.authorizedKeys.keyFiles = [ openssh.authorizedKeys.keyFiles = map (f: "${mysecrets}/ssh/user/${f}") [
"${secrets}/ssh/id_ed25519_sarien_user.pub" "id_dunamis_ed25519.pub"
"${secrets}/ssh/id_ed25519_eldrid_user.pub" "id_eldrid_ed25519.pub"
"id_sarien_ed25519.pub"
]; ];
}; };
}; };