nixos-config/modules/filesystems.nix

158 lines
4.2 KiB
Nix
Raw Normal View History

2019-09-18 02:23:45 +04:00
{ pkgs, lib, config, ... }:
with rec {
2020-08-15 19:36:16 +04:00
inherit (config) deviceSpecific secrets;
2019-09-18 02:23:45 +04:00
};
2020-08-07 15:57:08 +04:00
with deviceSpecific;
# let
# wgEnabled = config.secrets.wireguard.${config.device}.enable;
# in
{
2020-09-08 03:07:50 +04:00
2021-06-16 05:30:04 +03:00
# services.zfs = {
# trim.enable = true;
# trim.interval = "weekly";
# autoScrub.enable = true;
# autoScrub.interval = "weekly";
# autoSnapshot = {
# enable = true;
# frequent = 8;
# hourly = 8;
# daily = 4;
# weekly = 2;
# monthly = 2;
# };
# };
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}"
"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 = [
# "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 = [
"user=${secrets.linux-samba.user}"
"password=${secrets.linux-samba.password}"
"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"
"x-systemd.mount-timeout=15"
"_netdev"
2019-09-29 14:59:51 +04:00
];
2020-08-07 15:57:08 +04:00
# ] ++ lib.optionals wgEnabled [
# "x-systemd.after=wg-quick-wg0.service"
# ];
2019-09-28 01:53:49 +04:00
};
2019-09-29 14:59:51 +04:00
"/media/files" = if isHost then {
# Samba host
2020-11-10 00:09:40 +04:00
2019-09-28 01:53:49 +04:00
fsType = "ntfs";
device = "/dev/disk/by-partuuid/8a1d933c-302b-4e62-b9af-a45ecd05777f";
options = [
# "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}"
"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"
"x-systemd.mount-timeout=15"
"_netdev"
2019-09-29 14:59:51 +04:00
];
2020-08-07 15:57:08 +04:00
# ] ++ lib.optionals wgEnabled [
# "x-systemd.after=wg-quick-wg0.service"
# ];
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}"
"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"
"x-systemd.mount-timeout=15"
"_netdev"
2019-09-18 02:23:45 +04:00
];
2020-08-07 15:57:08 +04:00
# ] ++ lib.optionals wgEnabled [
# "x-systemd.after=wg-quick-wg0.service"
# ];
2019-09-18 02:23:45 +04:00
};
"/media/windows/data" = lib.mkIf (!isHost) {
fsType = "cifs";
device = "//192.168.0.100/Data";
options = [
"user=${secrets.windows-samba.user}"
"password=${secrets.windows-samba.password}"
"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"
"x-systemd.mount-timeout=15"
"_netdev"
2019-09-18 02:23:45 +04:00
];
2020-08-07 15:57:08 +04:00
# ] ++ lib.optionals wgEnabled [
# "x-systemd.after=wg-quick-wg0.service"
# ];
2019-09-18 02:23:45 +04:00
};
2020-08-15 19:36:16 +04:00
# Music folder
2021-06-16 05:30:04 +03:00
# TODO: FIXIT
2020-08-15 19:36:16 +04:00
"/home/alukard/Music" = {
fsType = "none";
device = "/media/windows/files/Music";
options = [
"uid=${toString config.users.users.alukard.uid}"
"gid=${toString config.users.groups.users.gid}"
"bind"
"nofail"
"x-systemd.requires-mounts-for=media-windows-files.mount"
"_netdev"
];
};
2019-08-27 23:41:02 +04:00
};
2020-03-22 01:07:54 +04:00
}