mirror of
https://github.com/foo-dogsquared/nixos-config.git
synced 2025-01-31 10:58:02 +00:00
profiles/filesystem: create module
This is primarily intended to centralize where we define our filesystems. This way, it would also avoid potential misconfiguration with the mount options.
This commit is contained in:
parent
2ad681bc46
commit
2c17d207b6
61
modules/nixos/profiles/filesystem.nix
Normal file
61
modules/nixos/profiles/filesystem.nix
Normal file
@ -0,0 +1,61 @@
|
||||
{ config, options, lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
cfg = config.profiles.filesystem;
|
||||
in {
|
||||
options.profiles.filesystem = {
|
||||
archive.enable = lib.mkOption {
|
||||
};
|
||||
|
||||
external-hdd.enable = lib.mkOption {
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkMerge [
|
||||
(lib.mkIf cfg.archive.enable {
|
||||
fileSystems."/mnt/archives" = {
|
||||
device = "/dev/disk/by-uuid/6ba86a30-5fa4-41d9-8354-fa8af0f57f49";
|
||||
fsType = "btrfs";
|
||||
noCheck = true;
|
||||
options = [
|
||||
# These are btrfs-specific mount options which can found in btrfs.5
|
||||
# manual page.
|
||||
"subvol=@"
|
||||
"noatime"
|
||||
"compress=zstd:9"
|
||||
"space_cache=v2"
|
||||
|
||||
# General mount options from mount.5 manual page.
|
||||
"noauto"
|
||||
"nofail"
|
||||
"user"
|
||||
|
||||
# See systemd.mount.5 and systemd.automount.5 manual page for more
|
||||
# details.
|
||||
"x-systemd.automount"
|
||||
"x-systemd.idle-timeout=2"
|
||||
"x-systemd.device-timeout=2"
|
||||
];
|
||||
};
|
||||
})
|
||||
|
||||
(lib.mkIf cfg.external-hdd.enable {
|
||||
fileSystems."/mnt/external-storage" = {
|
||||
device = "/dev/disk/by-uuid/665A391C5A38EB07";
|
||||
fsType = "ntfs";
|
||||
noCheck = true;
|
||||
options = [
|
||||
"nofail"
|
||||
"noauto"
|
||||
"user"
|
||||
|
||||
# See systemd.mount.5 and systemd.automount.5 manual page for more
|
||||
# details.
|
||||
"x-systemd.automount"
|
||||
"x-systemd.device-timeout=2"
|
||||
"x-systemd.idle-timeout=2"
|
||||
];
|
||||
};
|
||||
})
|
||||
];
|
||||
}
|
@ -58,46 +58,9 @@ in {
|
||||
"password"
|
||||
];
|
||||
|
||||
fileSystems."/mnt/external-storage" = {
|
||||
device = "/dev/disk/by-uuid/665A391C5A38EB07";
|
||||
fsType = "ntfs";
|
||||
noCheck = true;
|
||||
options = [
|
||||
"nofail"
|
||||
"noauto"
|
||||
"user"
|
||||
|
||||
# See systemd.mount.5 and systemd.automount.5 manual page for more
|
||||
# details.
|
||||
"x-systemd.automount"
|
||||
"x-systemd.device-timeout=2"
|
||||
"x-systemd.idle-timeout=2"
|
||||
];
|
||||
};
|
||||
|
||||
fileSystems."/mnt/archives" = {
|
||||
device = "/dev/disk/by-uuid/6ba86a30-5fa4-41d9-8354-fa8af0f57f49";
|
||||
fsType = "btrfs";
|
||||
noCheck = true;
|
||||
options = [
|
||||
# These are btrfs-specific mount options which can found in btrfs.5
|
||||
# manual page.
|
||||
"subvol=@"
|
||||
"noatime"
|
||||
"compress=zstd:9"
|
||||
"space_cache=v2"
|
||||
|
||||
# General mount options from mount.5 manual page.
|
||||
"noauto"
|
||||
"nofail"
|
||||
"user"
|
||||
|
||||
# See systemd.mount.5 and systemd.automount.5 manual page for more
|
||||
# details.
|
||||
"x-systemd.automount"
|
||||
"x-systemd.idle-timeout=2"
|
||||
"x-systemd.device-timeout=2"
|
||||
];
|
||||
profiles.filesystem = {
|
||||
archive.enable = true;
|
||||
external-hdd.enable = true;
|
||||
};
|
||||
|
||||
services.borgbackup.jobs = {
|
||||
|
@ -94,30 +94,7 @@ in
|
||||
"multimedia-archive/secrets-config" = getKey "secrets-config";
|
||||
};
|
||||
|
||||
fileSystems."${mountName}" = {
|
||||
device = "/dev/disk/by-uuid/6ba86a30-5fa4-41d9-8354-fa8af0f57f49";
|
||||
fsType = "btrfs";
|
||||
noCheck = true;
|
||||
options = [
|
||||
# These are btrfs-specific mount options which can found in btrfs.5
|
||||
# manual page.
|
||||
"subvol=@"
|
||||
"noatime"
|
||||
"compress=zstd:9"
|
||||
"space_cache=v2"
|
||||
|
||||
# General mount options from mount.5 manual page.
|
||||
"noauto"
|
||||
"nofail"
|
||||
"user"
|
||||
|
||||
# See systemd.mount.5 and systemd.automount.5 manual page for more
|
||||
# details.
|
||||
"x-systemd.automount"
|
||||
"x-systemd.idle-timeout=2"
|
||||
"x-systemd.device-timeout=2"
|
||||
];
|
||||
};
|
||||
profiles.filesystem.archive.enable = true;
|
||||
|
||||
services.yt-dlp = {
|
||||
enable = true;
|
||||
|
Loading…
Reference in New Issue
Block a user