sbc-deploys/modules/subvolumes/default.nix

22 lines
457 B
Nix
Raw Normal View History

{ device, subvolumes ? [ ] }:
2023-03-04 00:49:00 +00:00
{ lib, ... }:
{
2023-03-04 00:49:00 +00:00
fileSystems = lib.mkForce (builtins.foldl'
(acc: subvol:
let
length = builtins.stringLength subvol;
dirName = builtins.substring 1 length subvol;
in
acc // {
"/storage/${dirName}" = {
inherit device;
fsType = "btrfs";
options = [ "defaults" "compress=zstd" "rw" "subvol=${subvol}" ];
};
})
{ }
2023-03-04 00:49:00 +00:00
subvolumes);
}