about summary refs log tree commit diff
path: root/nixos/modules/tasks/filesystems
diff options
context:
space:
mode:
authornikstur <nikstur@outlook.com>2023-05-11 14:35:00 +0200
committernikstur <nikstur@outlook.com>2023-05-12 19:55:32 +0200
commitfa09e0a3c7cc91b766b0bd34fcfe51b69bd8cca6 (patch)
tree0e3e8d08649f8b80586a6eca1091ff3ec5fbae27 /nixos/modules/tasks/filesystems
parentb15daed9650fc367e483dd611d6f12976db16709 (diff)
downloadnixlib-fa09e0a3c7cc91b766b0bd34fcfe51b69bd8cca6.tar
nixlib-fa09e0a3c7cc91b766b0bd34fcfe51b69bd8cca6.tar.gz
nixlib-fa09e0a3c7cc91b766b0bd34fcfe51b69bd8cca6.tar.bz2
nixlib-fa09e0a3c7cc91b766b0bd34fcfe51b69bd8cca6.tar.lz
nixlib-fa09e0a3c7cc91b766b0bd34fcfe51b69bd8cca6.tar.xz
nixlib-fa09e0a3c7cc91b766b0bd34fcfe51b69bd8cca6.tar.zst
nixlib-fa09e0a3c7cc91b766b0bd34fcfe51b69bd8cca6.zip
nixos/filesystems: init erofs
Enable using an erofs filesystem as one of the filesystems needed to
boot the system. This is useful for example in image based deployments
where the Nix store is mounted read only.
[erofs](https://docs.kernel.org/filesystems/erofs.html) offers multiple
benefits over older filesystems like squashfs. Skip fsck.erofs because
it is still experimental.
Diffstat (limited to 'nixos/modules/tasks/filesystems')
-rw-r--r--nixos/modules/tasks/filesystems/erofs.nix21
1 files changed, 21 insertions, 0 deletions
diff --git a/nixos/modules/tasks/filesystems/erofs.nix b/nixos/modules/tasks/filesystems/erofs.nix
new file mode 100644
index 000000000000..a3d657669350
--- /dev/null
+++ b/nixos/modules/tasks/filesystems/erofs.nix
@@ -0,0 +1,21 @@
+{ config, lib, pkgs, ... }:
+
+let
+
+  inInitrd = lib.any (fs: fs == "erofs") config.boot.initrd.supportedFilesystems;
+  inSystem = lib.any (fs: fs == "erofs") config.boot.supportedFilesystems;
+
+in
+
+{
+  config = lib.mkIf (inInitrd || inSystem) {
+
+    system.fsPackages = [ pkgs.erofs-utils ];
+
+    boot.initrd.availableKernelModules = lib.mkIf inInitrd [ "erofs" ];
+
+    # fsck.erofs is currently experimental and should not be run as a
+    # privileged user. Thus, it is not included in the initrd.
+
+  };
+}