nixos-config/modules/filesystems.nix

131 lines
3.6 KiB
Nix
Raw Normal View History

2019-09-18 02:23:45 +04:00
{ pkgs, lib, config, ... }:
with rec {
2019-09-23 23:53:19 +04:00
inherit (config) device deviceSpecific secrets;
2019-09-18 02:23:45 +04:00
};
with deviceSpecific; {
2019-08-27 23:41:02 +04:00
fileSystems = {
"/" = {
2019-09-18 02:23:45 +04:00
options = if isSSD then
2019-09-14 22:12:56 +04:00
[ "ssd" "noatime" "compress=zstd" ]
2019-08-27 23:54:21 +04:00
else
2019-09-14 22:12:56 +04:00
[ "noatime" "compress=zstd" ];
2019-08-27 23:41:02 +04:00
};
2019-09-22 22:40:08 +04:00
"/.snapshots" = {
options = if isSSD then
[ "ssd" "noatime" "compress=zstd" ]
else
[ "noatime" "compress=zstd" ];
};
"/home" = {
options = if isSSD then
[ "ssd" "noatime" "compress=zstd" ]
else
[ "noatime" "compress=zstd" ];
};
2019-09-23 14:04:13 +04:00
"/nix/store" = {
2019-09-22 22:40:08 +04:00
options = if isSSD then
[ "ssd" "noatime" "compress=zstd" ]
else
[ "noatime" "compress=zstd" ];
};
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}"
"gid=${toString config.users.groups.smbgrp.gid}"
];
2019-08-27 23:41:02 +04:00
};
2019-09-29 14:59:51 +04:00
"/media/data" = if isHost then {
# Samba host
2019-09-28 01:53:49 +04:00
fsType = "ntfs";
2019-12-13 22:44:34 +04:00
device = "/dev/disk/by-partuuid/944f923d-cf08-4752-bf3f-8aa8e0190260";
2019-09-28 01:53:49 +04:00
options = [
2019-09-29 14:59:51 +04:00
# "ro"
2019-09-28 01:53:49 +04:00
# "noatime"
"nofail"
"uid=${toString config.users.users.alukard.uid}"
"gid=${toString config.users.groups.smbgrp.gid}"
];
2019-09-29 14:59:51 +04:00
} else {
# Linux samba
fsType = "cifs";
device = "//192.168.0.100/data";
options = [
"ro"
"user=${secrets.linux-samba.user}"
"password=${secrets.linux-samba.password}"
# "nofail"
"uid=${toString config.users.users.alukard.uid}"
"gid=${toString config.users.groups.users.gid}"
];
2019-09-28 01:53:49 +04:00
};
2019-09-29 14:59:51 +04:00
"/media/files" = if isHost then {
# Samba host
2019-09-28 01:53:49 +04:00
fsType = "ntfs";
device = "/dev/disk/by-partuuid/8a1d933c-302b-4e62-b9af-a45ecd05777f";
options = [
# "ro"
# "noatime"
"nofail"
"uid=${toString config.users.users.alukard.uid}"
"gid=${toString config.users.groups.smbgrp.gid}"
];
2019-09-29 14:59:51 +04:00
} else {
# Linux samba
fsType = "cifs";
device = "//192.168.0.100/files";
options = [
"user=${secrets.linux-samba.user}"
"password=${secrets.linux-samba.password}"
# "nofail"
"uid=${toString config.users.users.alukard.uid}"
"gid=${toString config.users.groups.users.gid}"
];
2019-09-28 01:53:49 +04:00
};
2019-09-28 02:24:58 +04:00
# Samba Windows
2019-09-18 02:23:45 +04:00
"/media/windows/files" = lib.mkIf (!isHost) {
fsType = "cifs";
device = "//192.168.0.100/Files";
options = [
"user=${secrets.windows-samba.user}"
"password=${secrets.windows-samba.password}"
2019-09-28 01:53:49 +04:00
# "nofail"
2019-09-18 02:23:45 +04:00
"uid=${toString config.users.users.alukard.uid}"
"gid=${toString config.users.groups.users.gid}"
];
};
"/media/windows/data" = lib.mkIf (!isHost) {
fsType = "cifs";
device = "//192.168.0.100/Data";
options = [
"ro"
"user=${secrets.windows-samba.user}"
"password=${secrets.windows-samba.password}"
2019-09-28 01:53:49 +04:00
# "nofail"
2019-09-18 02:23:45 +04:00
"uid=${toString config.users.users.alukard.uid}"
"gid=${toString config.users.groups.users.gid}"
];
};
2019-08-27 23:41:02 +04:00
};
2019-09-23 23:53:19 +04:00
swapDevices = [
{
2019-09-28 01:53:49 +04:00
device = if device == "AMD-Workstation" then
"/dev/disk/by-partuuid/3c4f9305-ad40-4ed3-b568-f1559f1c845a"
else if device == "Dell-Laptop" then
2020-01-23 01:29:27 +00:00
"/dev/disk/by-partuuid/e979f198-37c4-4a86-8138-e148c3d78447"
2019-09-25 20:47:27 +04:00
else if device == "NixOS-VM" then
2019-09-26 02:46:10 +04:00
"/dev/disk/by-partuuid/4caf1e45-2f1c-4cb2-a914-f2e90961503a"
2019-09-23 23:53:19 +04:00
else
"";
2019-09-25 02:44:22 +04:00
randomEncryption.enable = true;
2019-09-23 23:53:19 +04:00
}
];
2019-08-27 23:41:02 +04:00
}