| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- {
- config,
- pkgs,
- ...
- }:
- {
- environment.systemPackages = with pkgs; [
- mergerfs
- mergerfs-tools
- ];
- users.groups.storage.gid = 992;
- fileSystems."/mnt/storage" = {
- device = "/mnt/data*";
- options = [
- "category.create=mfs"
- "defaults"
- "allow_other"
- "use_ino"
- "moveonenospc=true"
- "minfreespace=25G"
- "func.getattr=newest"
- "func.create=ff"
- "fsname=storage"
- "gid=${toString config.users.groups.storage.gid}"
- ];
- fsType = "fuse.mergerfs";
- };
- systemd.services."chown-storage" = {
- description = "Ensure correct group ownership on the storage pool";
- wantedBy = [ "local-fs.target" ];
- after = [ "local-fs.target" ];
- script = ''
- ${pkgs.coreutils}/bin/chown -R :storage /mnt/data*
- ${pkgs.coreutils}/bin/chmod -R 0775 /mnt/data*
- ${pkgs.coreutils}/bin/chown -R :storage /mnt/parity*
- ${pkgs.coreutils}/bin/chmod -R 0775 /mnt/parity*
- '';
- serviceConfig = {
- Type = "oneshot";
- RemainAfterExit = "yes";
- };
- };
- }
|