summary refs log tree commit diff
path: root/modules/tasks/filesystems
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2012-03-09 14:37:58 +0000
committerEelco Dolstra <eelco.dolstra@logicblox.com>2012-03-09 14:37:58 +0000
commit03ebb883d18fb438de0bc27f4a209383adfa3419 (patch)
tree9486d7777b4b27b957bf3f0e05ea4efa1eb0e941 /modules/tasks/filesystems
parent8708578181a12a2cec7a8d9961af905be7ba35bc (diff)
downloadnixpkgs-03ebb883d18fb438de0bc27f4a209383adfa3419.tar
nixpkgs-03ebb883d18fb438de0bc27f4a209383adfa3419.tar.gz
nixpkgs-03ebb883d18fb438de0bc27f4a209383adfa3419.tar.bz2
nixpkgs-03ebb883d18fb438de0bc27f4a209383adfa3419.tar.lz
nixpkgs-03ebb883d18fb438de0bc27f4a209383adfa3419.tar.xz
nixpkgs-03ebb883d18fb438de0bc27f4a209383adfa3419.tar.zst
nixpkgs-03ebb883d18fb438de0bc27f4a209383adfa3419.zip
* Modularize filesystem support. Filesystems such as btrfs and
  reiserfs now have separate modules that are conditional on
  boot.supportedFilesystems and boot.initrd.supportedFilesystems.
  By default, these include the filesystems specified in the fsType
  attribute in fileSystems.  Ext2/3/4 support is currently
  unconditional.

  Also unbreak the installer test (http://hydra.nixos.org/build/2272302). 

svn path=/nixos/trunk/; revision=32954
Diffstat (limited to 'modules/tasks/filesystems')
-rw-r--r--modules/tasks/filesystems/btrfs.nix38
-rw-r--r--modules/tasks/filesystems/ext.nix22
-rw-r--r--modules/tasks/filesystems/nfs.nix25
-rw-r--r--modules/tasks/filesystems/reiserfs.nix25
4 files changed, 110 insertions, 0 deletions
diff --git a/modules/tasks/filesystems/btrfs.nix b/modules/tasks/filesystems/btrfs.nix
new file mode 100644
index 00000000000..c526b9677cf
--- /dev/null
+++ b/modules/tasks/filesystems/btrfs.nix
@@ -0,0 +1,38 @@
+{ config, pkgs, ... }:
+
+with pkgs.lib;
+
+let
+
+  inInitrd = any (fs: fs == "btrfs") config.boot.initrd.supportedFilesystems;
+
+in
+
+{
+  config = mkIf (any (fs: fs == "btrfs") config.boot.supportedFilesystems) {
+
+    system.fsPackages = [ pkgs.btrfsProgs ];
+
+    boot.initrd.kernelModules = mkIf inInitrd [ "btrfs" "crc32c" ];
+
+    boot.initrd.extraUtilsCommands = mkIf inInitrd
+      ''
+        cp -v ${pkgs.btrfsProgs}/bin/btrfsck $out/bin
+        cp -v ${pkgs.btrfsProgs}/bin/btrfs $out/bin
+        ln -sv btrfsck $out/bin/fsck.btrfs
+      '';
+
+    boot.initrd.postDeviceCommands = mkIf inInitrd
+      ''
+        btrfs device scan
+      '';
+
+    # !!! This is broken.  There should be a udev rule to do this when
+    # new devices are discovered.
+    jobs.udev.postStart =
+      ''
+        ${pkgs.btrfsProgs}/bin/btrfs device scan
+      '';
+
+  };
+}
diff --git a/modules/tasks/filesystems/ext.nix b/modules/tasks/filesystems/ext.nix
new file mode 100644
index 00000000000..93cdef4c664
--- /dev/null
+++ b/modules/tasks/filesystems/ext.nix
@@ -0,0 +1,22 @@
+{ config, pkgs, ... }:
+
+{
+  config = {
+
+    system.fsPackages = [ pkgs.e2fsprogs ];
+
+    boot.initrd.kernelModules = [ "ext2" "ext3" "ext4" ];
+
+    boot.initrd.extraUtilsCommands =
+      ''
+        # Copy e2fsck and friends.
+        cp -v ${pkgs.e2fsprogs}/sbin/e2fsck $out/bin
+        cp -v ${pkgs.e2fsprogs}/sbin/tune2fs $out/bin
+        ln -sv e2fsck $out/bin/fsck.ext2
+        ln -sv e2fsck $out/bin/fsck.ext3
+        ln -sv e2fsck $out/bin/fsck.ext4
+        cp -pdv ${pkgs.e2fsprogs}/lib/lib*.so.* $out/lib
+      '';
+
+  };
+}
diff --git a/modules/tasks/filesystems/nfs.nix b/modules/tasks/filesystems/nfs.nix
new file mode 100644
index 00000000000..546b6368721
--- /dev/null
+++ b/modules/tasks/filesystems/nfs.nix
@@ -0,0 +1,25 @@
+{ config, pkgs, ... }:
+
+with pkgs.lib;
+
+let
+
+  inInitrd = any (fs: fs == "nfs") config.boot.initrd.supportedFilesystems;
+
+in
+
+{
+  config = {
+
+    system.fsPackages = [ pkgs.nfsUtils ];
+
+    boot.initrd.kernelModules = mkIf inInitrd [ "nfs" ];
+
+    boot.initrd.extraUtilsCommands = mkIf inInitrd
+      ''
+        # !!! Uh, why don't we just install mount.nfs?
+        cp -v ${pkgs.klibc}/lib/klibc/bin.static/nfsmount $out/bin
+      '';
+
+  };
+}
diff --git a/modules/tasks/filesystems/reiserfs.nix b/modules/tasks/filesystems/reiserfs.nix
new file mode 100644
index 00000000000..f8c6a700004
--- /dev/null
+++ b/modules/tasks/filesystems/reiserfs.nix
@@ -0,0 +1,25 @@
+{ config, pkgs, ... }:
+
+with pkgs.lib;
+
+let
+
+  inInitrd = any (fs: fs == "reiserfs") config.boot.initrd.supportedFilesystems;
+
+in
+
+{
+  config = mkIf (any (fs: fs == "reiserfs") config.boot.supportedFilesystems) {
+
+    system.fsPackages = [ pkgs.reiserfsprogs ];
+
+    boot.initrd.kernelModules = mkIf inInitrd [ "reiserfs" ];
+
+    boot.initrd.extraUtilsCommands = mkIf inInitrd
+      ''
+        cp -v ${pkgs.reiserfsprogs}/sbin/reiserfsck $out/bin
+        ln -sv reiserfsck $out/bin/fsck.reiserfs
+      '';
+
+  };
+}