move syncthing from nixosModules to userModules/aly

This commit is contained in:
Aly Raffauf 2024-07-08 00:58:52 -04:00
parent 08f91eaad6
commit 23e37fa814
12 changed files with 128 additions and 139 deletions

View file

@ -43,8 +43,8 @@
"file://${config.home.homeDirectory}/src" "file://${config.home.homeDirectory}/src"
] ]
++ lib.optional ( ++ lib.optional (
osConfig.ar.services.syncthing.enable osConfig.ar.users.aly.syncthing.enable
&& (osConfig.ar.services.syncthing.user == config.home.username) && (config.home.username == "aly")
) "file://${config.home.homeDirectory}/sync"; ) "file://${config.home.homeDirectory}/sync";
xdg = { xdg = {

View file

@ -33,19 +33,17 @@
hyprland.enable = true; hyprland.enable = true;
}; };
services = { services.flatpak.enable = true;
flatpak.enable = true;
syncthing = {
enable = true;
syncMusic = false;
};
};
users = { users = {
aly = { aly = {
enable = true; enable = true;
password = "$y$j9T$0p6rc4p5sn0LJ/6XyAGP7.$.wmTafwMMscdW1o8kqqoHJP7U8kF.4WBmzzcPYielR3"; password = "$y$j9T$0p6rc4p5sn0LJ/6XyAGP7.$.wmTafwMMscdW1o8kqqoHJP7U8kF.4WBmzzcPYielR3";
syncthing = {
enable = true;
syncMusic = false;
};
}; };
dustin = { dustin = {

View file

@ -44,11 +44,10 @@
hyprland.enable = true; hyprland.enable = true;
}; };
services.syncthing.enable = true;
users.aly = { users.aly = {
enable = true; enable = true;
password = "$y$j9T$NSS7QcEtN4yiigPyofwlI/$nxdgz0lpySa0heDMjGlHe1gX3BWf48jK6Tkfg4xMEs6"; password = "$y$j9T$NSS7QcEtN4yiigPyofwlI/$nxdgz0lpySa0heDMjGlHe1gX3BWf48jK6Tkfg4xMEs6";
syncthing.enable = true;
}; };
}; };
} }

View file

@ -122,6 +122,11 @@ in {
aly = { aly = {
enable = true; enable = true;
password = "$y$j9T$SHPShqI2IpRE101Ey2ry/0$0mhW1f9LbVY02ifhJlP9XVImge9HOpf23s9i1JFLIt9"; password = "$y$j9T$SHPShqI2IpRE101Ey2ry/0$0mhW1f9LbVY02ifhJlP9XVImge9HOpf23s9i1JFLIt9";
syncthing = {
enable = true;
musicPath = "${mediaDirectory}/Music";
};
}; };
dustin = { dustin = {
@ -129,14 +134,6 @@ in {
password = "$y$j9T$3mMCBnUQ.xjuPIbSof7w0.$fPtRGblPRSwRLj7TFqk1nzuNQk2oVlgvb/bE47sghl."; password = "$y$j9T$3mMCBnUQ.xjuPIbSof7w0.$fPtRGblPRSwRLj7TFqk1nzuNQk2oVlgvb/bE47sghl.";
}; };
}; };
services = {
syncthing = {
enable = true;
syncMusic = true;
musicPath = "${mediaDirectory}/Music";
};
};
}; };
raffauflabs = { raffauflabs = {

View file

@ -65,11 +65,10 @@
hyprland.enable = true; hyprland.enable = true;
}; };
services.syncthing.enable = true;
users.aly = { users.aly = {
enable = true; enable = true;
password = "$y$j9T$TitXX3J690cnK41XciNMg/$APKHM/os6FKd9H9aXGxaHaQ8zP5SenO9EO94VYafl43"; password = "$y$j9T$TitXX3J690cnK41XciNMg/$APKHM/os6FKd9H9aXGxaHaQ8zP5SenO9EO94VYafl43";
syncthing.enable = true;
}; };
}; };
} }

View file

@ -40,11 +40,10 @@
hyprland.enable = true; hyprland.enable = true;
}; };
services.syncthing.enable = true;
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;
}; };
}; };
} }

View file

@ -44,28 +44,6 @@
services = { services = {
flatpak.enable = lib.mkEnableOption "Flatpak support with GUI."; flatpak.enable = lib.mkEnableOption "Flatpak support with GUI.";
syncthing = {
enable = lib.mkEnableOption "Syncthing sync service.";
user = lib.mkOption {
description = "Specify user Syncthing runs as.";
default = "aly";
type = lib.types.str;
};
syncMusic = lib.mkOption {
description = "Whether to sync music folder.";
default = config.ar.services.syncthing.enable;
type = lib.types.bool;
};
musicPath = lib.mkOption {
description = "Whether to sync music folder.";
default = "/home/${config.ar.services.syncthing.user}/music";
type = lib.types.str;
};
};
}; };
}; };
} }

View file

@ -6,6 +6,5 @@
}: { }: {
imports = [ imports = [
./flatpak ./flatpak
./syncthing
]; ];
} }

View file

@ -1,91 +0,0 @@
{
config,
lib,
pkgs,
...
}: {
config = let
cfg = config.ar.services.syncthing;
in
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";
services.syncthing = {
enable = true;
cert = config.age.secrets.syncthingCert.path;
dataDir = "/home/${cfg.user}";
key = config.age.secrets.syncthingKey.path;
openDefaultPorts = true;
user = cfg.user;
settings = {
options = {
localAnnounceEnabled = true;
relaysEnabled = true;
urAccepted = -1;
};
devices = {
"brawly" = {id = "BBIBWMR-CN4CFC4-2XMPLII-XFWXBT5-EPCZCAF-JOWAX5J-DHIGNM4-O3XQ4Q3";}; # Pixel 6a
"fallarbor" = {id = "P4URLH4-YWLMO6J-W62ET7H-TQAO3Y6-T2FAYOY-C2VTI65-VQXHVGG-NQ76PAZ";}; # Framework 13 Intel 11th gen
"gsgmba" = {id = "V2YCZSL-XY7H72L-FGJFWP2-JNYX72O-OJ5V2HY-V4SSSJM-77A7E3Z-7EJFAAV";}; # Work Macbook Air
"iphone12" = {id = "SBQNUXS-H4XDJ3E-RBHJPT5-45WDJJA-2U43M4P-23XGUJ7-E3CNNKZ-BXSGIA3";}; # iPhone 12 Pro Max
"lavaridge" = {id = "TMMSCVA-MDJTDPC-PC47NUA-2VPLAIB-6S6MEU7-KALIGUJ-AWDUOUU-XD73MAY";}; # Framework 13 AMD
"mauville" = {id = "52MTCMC-PKEWSAU-HADMTZU-DY5EKFO-B323P7V-OBXLNTQ-EJY7F7Y-EUWFBQX";}; # Desktop/Homelab
"mossdeep" = {id = "XRIGHMT-54OGBWP-UAAGAJS-LGTRHA2-EMKOMEB-EJEWKZN-GJFK6FO-3O6KQQ4";}; # Steam Deck OLED
"petalburg" = {id = "ECTD3LW-YZTJIXX-HLQYXT7-UGZSGST-3DDKF72-DJPMDHE-SUYDWIT-ASTKTAE";}; # Yoga 9i
"rustboro" = {id = "7CXGPQN-7DYDYJN-DKELOR3-RD4HZUW-SSUDGLZ-WVXYFUT-DPT2MGD-6PO5BQF";}; # Thinkpad t440p
"wallace" = {id = "X55NQL2-H3TEJ5U-EXZPBKQ-LI6BMB4-W2ULDIJ-YNIHJHB-4ISCOJB-UHNLYAX";}; # Samsung a35
"winona" = {id = "IGAW5SS-WY2QN6J-5TF74YZ-6XPNPTC-RCH3HIT-ZZQKCAI-6L54IS2-SNRIMA2";}; # Pixel Tablet
};
folders =
{
"sync" = {
id = "default";
path = "/home/${cfg.user}/sync";
devices = ["brawly" "fallarbor" "gsgmba" "iphone12" "lavaridge" "mauville" "petalburg" "rustboro" "mossdeep" "wallace" "winona"];
versioning = {
type = "staggered";
params = {
cleanInterval = "3600";
maxAge = "1";
};
};
};
"camera" = {
id = "fcsgh-dlxys";
path = "/home/${cfg.user}/pics/camera";
devices = ["brawly" "fallarbor" "lavaridge" "mauville" "petalburg" "rustboro" "wallace" "winona"];
versioning = {
params.cleanoutDays = "5";
type = "trashcan";
};
};
"screenshots" = {
id = "screenshots";
path = "/home/${cfg.user}/pics/screenshots";
devices = ["brawly" "fallarbor" "lavaridge" "mauville" "petalburg" "rustboro" "wallace" "winona"];
versioning = {
params.cleanoutDays = "5";
type = "trashcan";
};
};
}
// lib.attrsets.optionalAttrs (config.ar.services.syncthing.syncMusic) {
"music" = {
id = "6nzmu-z9der";
path = config.ar.services.syncthing.musicPath;
devices = ["lavaridge" "mauville" "petalburg" "rustboro" "wallace"];
};
};
};
};
};
}

View file

@ -6,6 +6,8 @@
self, self,
... ...
}: { }: {
imports = [./syncthing.nix];
config = lib.mkIf config.ar.users.aly.enable { config = lib.mkIf config.ar.users.aly.enable {
home-manager.users.aly = home-manager.users.aly =
lib.attrsets.optionalAttrs lib.attrsets.optionalAttrs

View file

@ -0,0 +1,90 @@
{
config,
lib,
pkgs,
...
}: let
cfg = config.ar.users.aly.syncthing;
in {
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";
services.syncthing = {
enable = true;
cert = config.age.secrets.syncthingCert.path;
dataDir = "/home/aly";
key = config.age.secrets.syncthingKey.path;
openDefaultPorts = true;
user = "aly";
settings = {
options = {
localAnnounceEnabled = true;
relaysEnabled = true;
urAccepted = -1;
};
devices = {
"brawly" = {id = "BBIBWMR-CN4CFC4-2XMPLII-XFWXBT5-EPCZCAF-JOWAX5J-DHIGNM4-O3XQ4Q3";}; # Pixel 6a
"fallarbor" = {id = "P4URLH4-YWLMO6J-W62ET7H-TQAO3Y6-T2FAYOY-C2VTI65-VQXHVGG-NQ76PAZ";}; # Framework 13 Intel 11th gen
"gsgmba" = {id = "V2YCZSL-XY7H72L-FGJFWP2-JNYX72O-OJ5V2HY-V4SSSJM-77A7E3Z-7EJFAAV";}; # Work Macbook Air
"iphone12" = {id = "SBQNUXS-H4XDJ3E-RBHJPT5-45WDJJA-2U43M4P-23XGUJ7-E3CNNKZ-BXSGIA3";}; # iPhone 12 Pro Max
"lavaridge" = {id = "TMMSCVA-MDJTDPC-PC47NUA-2VPLAIB-6S6MEU7-KALIGUJ-AWDUOUU-XD73MAY";}; # Framework 13 AMD
"mauville" = {id = "52MTCMC-PKEWSAU-HADMTZU-DY5EKFO-B323P7V-OBXLNTQ-EJY7F7Y-EUWFBQX";}; # Desktop/Homelab
"mossdeep" = {id = "XRIGHMT-54OGBWP-UAAGAJS-LGTRHA2-EMKOMEB-EJEWKZN-GJFK6FO-3O6KQQ4";}; # Steam Deck OLED
"petalburg" = {id = "ECTD3LW-YZTJIXX-HLQYXT7-UGZSGST-3DDKF72-DJPMDHE-SUYDWIT-ASTKTAE";}; # Yoga 9i
"rustboro" = {id = "7CXGPQN-7DYDYJN-DKELOR3-RD4HZUW-SSUDGLZ-WVXYFUT-DPT2MGD-6PO5BQF";}; # Thinkpad t440p
"wallace" = {id = "X55NQL2-H3TEJ5U-EXZPBKQ-LI6BMB4-W2ULDIJ-YNIHJHB-4ISCOJB-UHNLYAX";}; # Samsung a35
"winona" = {id = "IGAW5SS-WY2QN6J-5TF74YZ-6XPNPTC-RCH3HIT-ZZQKCAI-6L54IS2-SNRIMA2";}; # Pixel Tablet
};
folders =
{
"sync" = {
id = "default";
path = "/home/aly/sync";
devices = ["brawly" "fallarbor" "gsgmba" "iphone12" "lavaridge" "mauville" "petalburg" "rustboro" "mossdeep" "wallace" "winona"];
versioning = {
type = "staggered";
params = {
cleanInterval = "3600";
maxAge = "1";
};
};
};
"camera" = {
id = "fcsgh-dlxys";
path = "/home/aly/pics/camera";
devices = ["brawly" "fallarbor" "lavaridge" "mauville" "petalburg" "rustboro" "wallace" "winona"];
versioning = {
params.cleanoutDays = "5";
type = "trashcan";
};
};
"screenshots" = {
id = "screenshots";
path = "/home/aly/pics/screenshots";
devices = ["brawly" "fallarbor" "lavaridge" "mauville" "petalburg" "rustboro" "wallace" "winona"];
versioning = {
params.cleanoutDays = "5";
type = "trashcan";
};
};
}
// lib.attrsets.optionalAttrs (config.ar.users.aly.syncthing.syncMusic) {
"music" = {
id = "6nzmu-z9der";
path = config.ar.users.aly.syncthing.musicPath;
devices = ["lavaridge" "mauville" "petalburg" "rustboro" "wallace"];
};
};
};
};
};
}

View file

@ -35,7 +35,26 @@
]; ];
}; };
aly = mkUser "aly"; aly =
mkUser "aly"
// {
syncthing = {
enable = lib.mkEnableOption "Syncthing sync service.";
syncMusic = lib.mkOption {
description = "Whether to sync music folder.";
default = config.ar.users.aly.syncthing.enable;
type = lib.types.bool;
};
musicPath = lib.mkOption {
description = "Whether to sync music folder.";
default = "/home/aly/music";
type = lib.types.str;
};
};
};
dustin = mkUser "dustin"; dustin = mkUser "dustin";
morgan = mkUser "morgan"; morgan = mkUser "morgan";
}; };