userModules/aly/syncthing: handle secrets

This commit is contained in:
Aly Raffauf 2024-07-08 01:29:09 -04:00
parent 23e37fa814
commit ed82d1e7b8
7 changed files with 58 additions and 14 deletions

View file

@ -13,6 +13,11 @@
inputs.nixhw.nixosModules.framework-13-intel-11th inputs.nixhw.nixosModules.framework-13-intel-11th
]; ];
age.secrets = {
syncthingCert.file = ../../secrets/syncthing/fallarbor/cert.age;
syncthingKey.file = ../../secrets/syncthing/fallarbor/key.age;
};
boot.loader = { boot.loader = {
efi.canTouchEfiVariables = true; efi.canTouchEfiVariables = true;
systemd-boot.enable = true; systemd-boot.enable = true;
@ -42,6 +47,8 @@
syncthing = { syncthing = {
enable = true; enable = true;
certFile = config.age.secrets.syncthingCert.path;
keyFile = config.age.secrets.syncthingKey.path;
syncMusic = false; syncMusic = false;
}; };
}; };

View file

@ -14,6 +14,11 @@
inputs.nixhw.nixosModules.framework-13-amd-7000 inputs.nixhw.nixosModules.framework-13-amd-7000
]; ];
age.secrets = {
syncthingCert.file = ../../secrets/syncthing/lavaridge/cert.age;
syncthingKey.file = ../../secrets/syncthing/lavaridge/key.age;
};
boot.loader = { boot.loader = {
efi.canTouchEfiVariables = true; efi.canTouchEfiVariables = true;
systemd-boot.enable = true; systemd-boot.enable = true;
@ -47,7 +52,11 @@
users.aly = { users.aly = {
enable = true; enable = true;
password = "$y$j9T$NSS7QcEtN4yiigPyofwlI/$nxdgz0lpySa0heDMjGlHe1gX3BWf48jK6Tkfg4xMEs6"; password = "$y$j9T$NSS7QcEtN4yiigPyofwlI/$nxdgz0lpySa0heDMjGlHe1gX3BWf48jK6Tkfg4xMEs6";
syncthing.enable = true; syncthing = {
enable = true;
certFile = config.age.secrets.syncthingCert.path;
keyFile = config.age.secrets.syncthingKey.path;
};
}; };
}; };
} }

View file

@ -42,6 +42,9 @@ in {
owner = "navidrome"; owner = "navidrome";
file = ../../secrets/spotify/clientSecret.age; file = ../../secrets/spotify/clientSecret.age;
}; };
syncthingCert.file = ../../secrets/syncthing/mauville/cert.age;
syncthingKey.file = ../../secrets/syncthing/mauville/key.age;
}; };
boot = { boot = {
@ -125,6 +128,8 @@ in {
syncthing = { syncthing = {
enable = true; enable = true;
certFile = config.age.secrets.syncthingCert.path;
keyFile = config.age.secrets.syncthingKey.path;
musicPath = "${mediaDirectory}/Music"; musicPath = "${mediaDirectory}/Music";
}; };
}; };

View file

@ -13,6 +13,11 @@
inputs.nixhw.nixosModules.lenovo-yoga-9i-intel-13th inputs.nixhw.nixosModules.lenovo-yoga-9i-intel-13th
]; ];
age.secrets = {
syncthingCert.file = ../../secrets/syncthing/petalburg/cert.age;
syncthingKey.file = ../../secrets/syncthing/petalburg/key.age;
};
boot.loader = { boot.loader = {
efi.canTouchEfiVariables = true; efi.canTouchEfiVariables = true;
systemd-boot.enable = true; systemd-boot.enable = true;
@ -68,7 +73,11 @@
users.aly = { users.aly = {
enable = true; enable = true;
password = "$y$j9T$TitXX3J690cnK41XciNMg/$APKHM/os6FKd9H9aXGxaHaQ8zP5SenO9EO94VYafl43"; password = "$y$j9T$TitXX3J690cnK41XciNMg/$APKHM/os6FKd9H9aXGxaHaQ8zP5SenO9EO94VYafl43";
syncthing.enable = true; syncthing = {
enable = true;
certFile = config.age.secrets.syncthingCert.path;
keyFile = config.age.secrets.syncthingKey.path;
};
}; };
}; };
} }

View file

@ -14,6 +14,11 @@
inputs.nixhw.nixosModules.thinkpad-t440p inputs.nixhw.nixosModules.thinkpad-t440p
]; ];
age.secrets = {
syncthingCert.file = ../../secrets/syncthing/rustboro/cert.age;
syncthingKey.file = ../../secrets/syncthing/rustboro/key.age;
};
boot.loader = { boot.loader = {
efi.canTouchEfiVariables = true; efi.canTouchEfiVariables = true;
systemd-boot.enable = true; systemd-boot.enable = true;
@ -43,7 +48,11 @@
users.aly = { users.aly = {
enable = true; enable = true;
password = "$y$j9T$VdtiEyMOegHpcUwgmCVFD0$K8Ne6.zk//VJNq2zxVQ0xE0Wg3LohvAQd3Xm9aXdM15"; password = "$y$j9T$VdtiEyMOegHpcUwgmCVFD0$K8Ne6.zk//VJNq2zxVQ0xE0Wg3LohvAQd3Xm9aXdM15";
syncthing.enable = true; syncthing = {
enable = true;
certFile = config.age.secrets.syncthingCert.path;
keyFile = config.age.secrets.syncthingKey.path;
};
}; };
}; };
} }

View file

@ -7,18 +7,13 @@
cfg = config.ar.users.aly.syncthing; cfg = config.ar.users.aly.syncthing;
in { in {
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
age.secrets = {
syncthingCert.file = ../../secrets/syncthing + "/${config.networking.hostName}/cert.age";
syncthingKey.file = ../../secrets/syncthing + "/${config.networking.hostName}/key.age";
};
systemd.services.syncthing.environment.STNODEFAULTFOLDER = "true"; systemd.services.syncthing.environment.STNODEFAULTFOLDER = "true";
services.syncthing = { services.syncthing = {
enable = true; enable = true;
cert = config.age.secrets.syncthingCert.path; cert = cfg.certFile;
dataDir = "/home/aly"; dataDir = "/home/aly";
key = config.age.secrets.syncthingKey.path; key = cfg.keyFile;
openDefaultPorts = true; openDefaultPorts = true;
user = "aly"; user = "aly";
settings = { settings = {

View file

@ -41,10 +41,14 @@
syncthing = { syncthing = {
enable = lib.mkEnableOption "Syncthing sync service."; enable = lib.mkEnableOption "Syncthing sync service.";
syncMusic = lib.mkOption { certFile = lib.mkOption {
description = "Whether to sync music folder."; description = "Syncthing cert file.";
default = config.ar.users.aly.syncthing.enable; type = lib.types.nonEmptyStr;
type = lib.types.bool; };
keyFile = lib.mkOption {
description = "Syncthing key file.";
type = lib.types.nonEmptyStr;
}; };
musicPath = lib.mkOption { musicPath = lib.mkOption {
@ -52,6 +56,12 @@
default = "/home/aly/music"; default = "/home/aly/music";
type = lib.types.str; type = lib.types.str;
}; };
syncMusic = lib.mkOption {
description = "Whether to sync music folder.";
default = config.ar.users.aly.syncthing.enable;
type = lib.types.bool;
};
}; };
}; };