summary refs log tree commit diff
path: root/nixos/modules/tasks
diff options
context:
space:
mode:
authordavidak <git@davidak.de>2017-08-31 05:24:48 -0500
committerJörg Thalheim <joerg@thalheim.io>2017-08-31 05:39:31 -0500
commit8f389f331641561c2c0355edd9e83593bf908a39 (patch)
tree39920c2dd9860f5f64ab3e963c340b6387909312 /nixos/modules/tasks
parentbd79b8c9fc918223e28dc29e7afa2673bebb5392 (diff)
downloadnixlib-8f389f331641561c2c0355edd9e83593bf908a39.tar
nixlib-8f389f331641561c2c0355edd9e83593bf908a39.tar.gz
nixlib-8f389f331641561c2c0355edd9e83593bf908a39.tar.bz2
nixlib-8f389f331641561c2c0355edd9e83593bf908a39.tar.lz
nixlib-8f389f331641561c2c0355edd9e83593bf908a39.tar.xz
nixlib-8f389f331641561c2c0355edd9e83593bf908a39.tar.zst
nixlib-8f389f331641561c2c0355edd9e83593bf908a39.zip
nixos/bcachefs: init module
Diffstat (limited to 'nixos/modules/tasks')
-rw-r--r--nixos/modules/tasks/filesystems/bcachefs.nix26
1 files changed, 26 insertions, 0 deletions
diff --git a/nixos/modules/tasks/filesystems/bcachefs.nix b/nixos/modules/tasks/filesystems/bcachefs.nix
new file mode 100644
index 000000000000..227707173a3d
--- /dev/null
+++ b/nixos/modules/tasks/filesystems/bcachefs.nix
@@ -0,0 +1,26 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+
+  inInitrd = any (fs: fs == "bcachefs") config.boot.initrd.supportedFilesystems;
+
+in
+
+{
+  config = mkIf (any (fs: fs == "bcachefs") config.boot.supportedFilesystems) {
+
+    system.fsPackages = [ pkgs.bcachefs-tools ];
+
+    # use kernel package with bcachefs support until it's in mainline
+    boot.kernelPackages = pkgs.linuxPackages_testing_bcachefs;
+    boot.initrd.availableKernelModules = mkIf inInitrd [ "bcachefs" ];
+
+    boot.initrd.extraUtilsCommands = mkIf inInitrd
+      ''
+        copy_bin_and_libs ${pkgs.bcachefs-tools}/bin/fsck.bcachefs
+      '';
+
+  };
+}