nixos-config/modules/filesystems.nix

81 lines
2.1 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-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}"
"nofail"
"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}"
"nofail"
"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-25 02:44:22 +04:00
device = if device == "Dell-Laptop" then
"/dev/disk/by-partuuid/2de40bc4-a91c-4c89-a2cd-cbf34a0adf01"
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
}