diff --git a/machines/moritz-server/configuration.nix b/machines/moritz-server/configuration.nix index f587a99..8d3b531 100644 --- a/machines/moritz-server/configuration.nix +++ b/machines/moritz-server/configuration.nix @@ -12,6 +12,7 @@ ./mail-server.nix ./website/root ./navidrome.nix + ./yottamaster.nix inputs.home-manager.nixosModules.default ]; diff --git a/machines/moritz-server/navidrome.nix b/machines/moritz-server/navidrome.nix index 5b52614..b143645 100644 --- a/machines/moritz-server/navidrome.nix +++ b/machines/moritz-server/navidrome.nix @@ -7,6 +7,7 @@ enable = true; settings = { MusicFolder = "/mnt/music/tagged"; + DataFolder = "/var/lib/navidrome"; }; }; @@ -38,6 +39,7 @@ ]; musicbrainz.genres = true; lyrics.synced = true; + replaygain.backend = "ffmpeg"; }; }; @@ -45,6 +47,7 @@ music = { paths = [ config.services.navidrome.settings.MusicFolder + config.services.navidrome.settings.DataFolder config.home-manager.users.moritz.programs.beets.settings.library ]; repo = "u461386-sub1@u461386.your-storagebox.de:music"; diff --git a/machines/moritz-server/yottamaster.nix b/machines/moritz-server/yottamaster.nix new file mode 100644 index 0000000..faeb536 --- /dev/null +++ b/machines/moritz-server/yottamaster.nix @@ -0,0 +1,64 @@ +{ + clan-core, + config, + lib, + ... +}: let + suffix = config.clan.core.vars.generators.disk-id.files.diskId.value; +in { + imports = [ + clan-core.clanModules.disk-id + ]; + + boot.loader.systemd-boot.enable = true; + disko.devices = { + disk = let + disks = ["/dev/disk/by-id/usb-JMicron_Generic_DISK00_0123456789ABCDEF-0:0" "/dev/disk/by-id/usb-JMicron_Generic_DISK01_0123456789ABCDEF-0:1"]; + mkDisk = name: device: { + inherit device; + # suffix is to prevent disk name collisions + name = name + "-" + suffix; + type = "disk"; + content = { + type = "gpt"; + partitions = { + "zfs" = { + size = "100%"; + content = { + type = "zfs"; + pool = "yottamaster"; + }; + }; + }; + }; + }; + kv = + lib.imap0 (i: v: rec { + name = "yottamaster" + builtins.toString i; + value = mkDisk name v; + }) + disks; + in + builtins.listToAttrs kv; + zpool = { + yottamaster = { + type = "zpool"; + mode = "mirror"; + # Workaround: cannot import 'zroot': I/O error in disko tests + options.cachefile = "none"; + rootFsOptions = { + compression = "zstd"; + "com.sun:auto-snapshot" = "false"; + }; + + datasets = { + music = { + type = "zfs_fs"; + mountpoint = "/music"; + options."com.sun:auto-snapshot" = "true"; + }; + }; + }; + }; + }; +}