nixos-config/profiles/filesystems.nix

87 lines
2.4 KiB
Nix
Raw Normal View History

2019-09-18 02:23:45 +04:00
{ pkgs, lib, config, ... }:
with rec {
2021-06-29 22:28:37 +03:00
inherit (config) deviceSpecific secrets device;
2019-09-18 02:23:45 +04:00
};
2020-08-07 15:57:08 +04:00
with deviceSpecific;
{
2022-06-06 20:26:10 +03:00
secrets.samba.services = [];
secrets.files-veracrypt = {};
2022-09-23 21:26:59 +03:00
environment.etc.crypttab = lib.mkIf (device == "AMD-Workstation") {
text = ''
files-veracrypt /dev/disk/by-partuuid/15fa11a1-a6d8-4962-9c03-74b209d7c46a /var/secrets/files-veracrypt tcrypt-veracrypt
'';
};
2020-09-08 03:07:50 +04:00
2019-08-27 23:41:02 +04:00
fileSystems = {
2019-09-18 02:23:45 +04:00
"/shared/nixos" = lib.mkIf isVM {
2019-08-27 23:41:02 +04:00
fsType = "vboxsf";
device = "shared";
2019-09-16 15:01:09 +04:00
options = [
"rw"
"nodev"
"relatime"
"nofail"
"dmode=0755"
"fmode=0644"
"uid=${toString config.users.users.alukard.uid}"
2021-09-28 01:39:21 +03:00
"gid=${toString config.users.groups.smbuser.gid}"
2019-09-16 15:01:09 +04:00
];
2019-08-27 23:41:02 +04:00
};
2021-06-29 22:28:37 +03:00
"/media/data" = if (device == "AMD-Workstation") then {
2019-09-29 14:59:51 +04:00
# Samba host
2019-09-28 01:53:49 +04:00
fsType = "ntfs";
2021-06-29 22:28:37 +03:00
device = "/dev/disk/by-partuuid/a61ac8ea-53b9-462f-8a93-a5c07b131209";
2019-09-28 01:53:49 +04:00
options = [
# "noatime"
"nofail"
"uid=${toString config.users.users.alukard.uid}"
2021-09-28 01:39:21 +03:00
"gid=${toString config.users.groups.smbuser.gid}"
2019-09-28 01:53:49 +04:00
];
2019-09-29 14:59:51 +04:00
} else {
# Linux samba
fsType = "cifs";
device = "//192.168.0.100/data";
options = [
2021-06-29 22:28:37 +03:00
"credentials=${secrets.samba.decrypted}"
2019-09-29 14:59:51 +04:00
"uid=${toString config.users.users.alukard.uid}"
"gid=${toString config.users.groups.users.gid}"
2020-08-07 15:57:08 +04:00
"vers=3.0"
"nofail"
"noauto"
"x-systemd.automount"
2021-06-29 22:28:37 +03:00
"x-systemd.mount-timeout=5"
2020-08-07 15:57:08 +04:00
"_netdev"
2019-09-29 14:59:51 +04:00
];
2019-09-28 01:53:49 +04:00
};
2022-04-22 02:14:31 +03:00
# "/media/files" = if (device == "AMD-Workstation") then {
"/media/files" = lib.mkIf (device == "AMD-Workstation") {
2019-09-29 14:59:51 +04:00
# Samba host
2019-09-28 01:53:49 +04:00
fsType = "ntfs";
2022-06-06 20:26:10 +03:00
device = "/dev/mapper/files-veracrypt";
2019-09-28 01:53:49 +04:00
options = [
# "noatime"
"nofail"
"uid=${toString config.users.users.alukard.uid}"
2021-09-28 01:39:21 +03:00
"gid=${toString config.users.groups.smbuser.gid}"
2019-09-28 01:53:49 +04:00
];
2020-08-15 19:36:16 +04:00
};
2022-04-22 02:14:31 +03:00
# } else {
# Linux samba
# fsType = "cifs";
# device = "//192.168.0.100/files";
# options = [
# "credentials=${secrets.samba.decrypted}"
# "uid=${toString config.users.users.alukard.uid}"
# "gid=${toString config.users.groups.users.gid}"
# "vers=3.0"
# "nofail"
# "noauto"
# "x-systemd.automount"
# "x-systemd.mount-timeout=5"
# "_netdev"
# ];
# };
2019-08-27 23:41:02 +04:00
};
2020-03-22 01:07:54 +04:00
}