dotfiles/systems/deimos/config/filesystem.nix

92 lines
2.1 KiB
Nix
Raw Normal View History

2024-10-06 15:25:05 -05:00
{
flake,
config,
...
2025-01-31 01:49:36 -06:00
}:
let
inherit (flake.config.people)
2025-01-08 19:06:14 -06:00
user0
user1
;
2025-01-31 01:49:36 -06:00
inherit (flake.config.machines.devices)
2025-03-01 15:58:02 -06:00
deimos
2025-01-08 19:06:14 -06:00
synology
ceres
2025-01-08 19:06:14 -06:00
;
2025-01-31 01:49:36 -06:00
inherit (flake.config.services.instances)
2025-01-08 19:06:14 -06:00
samba
2025-03-20 20:04:44 -05:00
jellyfin
audiobookshelf
2025-01-08 19:06:14 -06:00
;
2024-10-09 23:26:43 -05:00
synologySecrets = config.sops.secrets."network/synology".path;
ceresSecrets = config.sops.secrets."network/server".path;
2025-01-31 01:49:36 -06:00
in
{
fileSystems =
let
synologyDrives = [
"folder0"
"folder1"
"folder2"
];
2024-10-06 15:25:05 -05:00
2025-01-31 01:49:36 -06:00
sambaDrives = [
"samba0"
];
2024-10-06 15:25:05 -05:00
2025-03-20 20:04:44 -05:00
sambaFolders = [
audiobookshelf.name
jellyfin.name
];
2025-01-31 01:49:36 -06:00
synologyMounts = synologyDrive: {
name = "${synology.${synologyDrive}.mount}";
value = {
device = synology.${synologyDrive}.device;
fsType = "cifs";
options = synology.${synologyDrive}.options ++ [
2025-01-08 19:11:58 -06:00
"credentials=${synologySecrets}"
];
2025-01-31 01:49:36 -06:00
};
2024-10-06 15:25:05 -05:00
};
2025-03-20 20:04:44 -05:00
sambaMounts = sambaDrive: folder: {
name = "${ceres.${sambaDrive}.mount}/${folder}";
2025-01-31 01:49:36 -06:00
value = {
2025-03-20 20:04:44 -05:00
device = "${ceres.${sambaDrive}.device}/${folder}";
2025-01-31 01:49:36 -06:00
fsType = "cifs";
options = ceres.${sambaDrive}.options ++ [
"credentials=${ceresSecrets}"
2025-01-08 19:11:58 -06:00
];
2025-01-31 01:49:36 -06:00
};
2024-10-06 15:25:05 -05:00
};
2025-01-31 01:49:36 -06:00
in
2024-10-06 15:25:05 -05:00
{
"/" = {
2025-03-21 22:35:22 -05:00
device = "/dev/disk/by-uuid/c9a82c93-1da4-4cd1-a1fa-26483271a2bb";
2024-10-06 15:25:05 -05:00
fsType = "ext4";
};
"/boot" = {
2025-03-21 22:35:22 -05:00
device = "/dev/disk/by-uuid/71CA-765A";
2024-10-06 15:25:05 -05:00
fsType = "vfat";
2025-03-01 15:58:02 -06:00
options = deimos.boot.options;
2024-10-06 15:25:05 -05:00
};
}
2025-03-22 23:35:09 -05:00
// (builtins.listToAttrs (map synologyMounts synologyDrives))
// (builtins.listToAttrs (
builtins.concatMap (drive: map (folder: sambaMounts drive folder) sambaFolders) sambaDrives
));
2024-10-06 15:25:05 -05:00
swapDevices = [
2025-03-21 22:35:22 -05:00
{ device = "/dev/disk/by-uuid/74007bf1-6e2f-425e-99fa-d35990f4ea37"; }
2024-10-06 15:25:05 -05:00
];
systemd.tmpfiles.rules = [
"Z ${config.home-manager.users.${user0}.home.homeDirectory} 0755 ${user0} users -"
2025-03-22 23:35:09 -05:00
"Z ${config.home-manager.users.${user1}.home.homeDirectory} 0755 ${user1} users -"
2024-10-06 15:25:05 -05:00
];
services.udisks2.enable = true;
}