Move CIFS support into a separate module
This commit is contained in:
parent
cf744cb715
commit
b7c543136a
@ -316,11 +316,12 @@
|
|||||||
./system/upstart/upstart.nix
|
./system/upstart/upstart.nix
|
||||||
./tasks/cpu-freq.nix
|
./tasks/cpu-freq.nix
|
||||||
./tasks/encrypted-devices.nix
|
./tasks/encrypted-devices.nix
|
||||||
|
./tasks/filesystems.nix
|
||||||
./tasks/filesystems/btrfs.nix
|
./tasks/filesystems/btrfs.nix
|
||||||
|
./tasks/filesystems/cifs.nix
|
||||||
./tasks/filesystems/ext.nix
|
./tasks/filesystems/ext.nix
|
||||||
./tasks/filesystems/f2fs.nix
|
./tasks/filesystems/f2fs.nix
|
||||||
./tasks/filesystems/nfs.nix
|
./tasks/filesystems/nfs.nix
|
||||||
./tasks/filesystems.nix
|
|
||||||
./tasks/filesystems/reiserfs.nix
|
./tasks/filesystems/reiserfs.nix
|
||||||
./tasks/filesystems/unionfs-fuse.nix
|
./tasks/filesystems/unionfs-fuse.nix
|
||||||
./tasks/filesystems/vfat.nix
|
./tasks/filesystems/vfat.nix
|
||||||
|
@ -23,22 +23,6 @@ let
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
needsCifsUtils = kernelPackages.kernel ? features
|
|
||||||
&& kernelPackages.kernel.features ? needsCifsUtils
|
|
||||||
&& kernelPackages.kernel.features.needsCifsUtils
|
|
||||||
&& any (fs: fs.fsType == "cifs") fileSystems;
|
|
||||||
|
|
||||||
busybox =
|
|
||||||
if needsCifsUtils
|
|
||||||
then pkgs.busybox.override {
|
|
||||||
extraConfig = ''
|
|
||||||
CONFIG_FEATURE_MOUNT_CIFS n
|
|
||||||
CONFIG_FEATURE_MOUNT_HELPERS y
|
|
||||||
'';
|
|
||||||
}
|
|
||||||
else pkgs.busybox;
|
|
||||||
|
|
||||||
|
|
||||||
# Some additional utilities needed in stage 1, like mount, lvm, fsck
|
# Some additional utilities needed in stage 1, like mount, lvm, fsck
|
||||||
# etc. We don't want to bring in all of those packages, so we just
|
# etc. We don't want to bring in all of those packages, so we just
|
||||||
# copy what we need. Instead of using statically linked binaries,
|
# copy what we need. Instead of using statically linked binaries,
|
||||||
@ -62,7 +46,7 @@ let
|
|||||||
cp -pv ${pkgs.gcc.gcc}/lib*/libgcc_s.so.* $out/lib
|
cp -pv ${pkgs.gcc.gcc}/lib*/libgcc_s.so.* $out/lib
|
||||||
|
|
||||||
# Copy BusyBox.
|
# Copy BusyBox.
|
||||||
cp -rvd ${busybox}/{bin,sbin} $out/
|
cp -rvd ${pkgs.busybox}/{bin,sbin} $out/
|
||||||
chmod -R u+w $out
|
chmod -R u+w $out
|
||||||
|
|
||||||
# Copy some utillinux stuff.
|
# Copy some utillinux stuff.
|
||||||
@ -91,11 +75,6 @@ let
|
|||||||
cp -v ${pkgs.kmod}/bin/kmod $out/bin/
|
cp -v ${pkgs.kmod}/bin/kmod $out/bin/
|
||||||
ln -s kmod $out/bin/modprobe
|
ln -s kmod $out/bin/modprobe
|
||||||
|
|
||||||
# Maybe copy cifs utils
|
|
||||||
${optionalString needsCifsUtils ''
|
|
||||||
cp -v ${pkgs.cifs_utils}/sbin/mount.cifs $out/bin
|
|
||||||
''}
|
|
||||||
|
|
||||||
${config.boot.initrd.extraUtilsCommands}
|
${config.boot.initrd.extraUtilsCommands}
|
||||||
|
|
||||||
# Strip binaries further than normal.
|
# Strip binaries further than normal.
|
||||||
|
@ -137,7 +137,7 @@ in
|
|||||||
system.fsPackages = [ pkgs.dosfstools ];
|
system.fsPackages = [ pkgs.dosfstools ];
|
||||||
|
|
||||||
environment.systemPackages =
|
environment.systemPackages =
|
||||||
[ pkgs.ntfs3g pkgs.cifs_utils pkgs.fuse ]
|
[ pkgs.ntfs3g pkgs.fuse ]
|
||||||
++ config.system.fsPackages;
|
++ config.system.fsPackages;
|
||||||
|
|
||||||
environment.etc.fstab.text =
|
environment.etc.fstab.text =
|
||||||
|
25
nixos/modules/tasks/filesystems/cifs.nix
Normal file
25
nixos/modules/tasks/filesystems/cifs.nix
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
|
with lib;
|
||||||
|
|
||||||
|
let
|
||||||
|
|
||||||
|
inInitrd = any (fs: fs == "cifs") config.boot.initrd.supportedFilesystems;
|
||||||
|
|
||||||
|
in
|
||||||
|
|
||||||
|
{
|
||||||
|
config = {
|
||||||
|
|
||||||
|
system.fsPackages = [ pkgs.cifs_utils ];
|
||||||
|
|
||||||
|
boot.initrd.availableKernelModules = mkIf inInitrd
|
||||||
|
[ "cifs" "nls_utf8" "hmac" "md4" "ecb" "des_generic" "sha256" ];
|
||||||
|
|
||||||
|
boot.initrd.extraUtilsCommands = mkIf inInitrd
|
||||||
|
''
|
||||||
|
cp -v ${pkgs.cifs_utils}/sbin/mount.cifs $out/bin
|
||||||
|
'';
|
||||||
|
|
||||||
|
};
|
||||||
|
}
|
@ -28,6 +28,10 @@ let
|
|||||||
nixConfig = ''
|
nixConfig = ''
|
||||||
CONFIG_PREFIX "$out"
|
CONFIG_PREFIX "$out"
|
||||||
CONFIG_INSTALL_NO_USR y
|
CONFIG_INSTALL_NO_USR y
|
||||||
|
|
||||||
|
# Use the external mount.cifs program.
|
||||||
|
CONFIG_FEATURE_MOUNT_CIFS n
|
||||||
|
CONFIG_FEATURE_MOUNT_HELPERS y
|
||||||
'';
|
'';
|
||||||
|
|
||||||
staticConfig = stdenv.lib.optionalString enableStatic ''
|
staticConfig = stdenv.lib.optionalString enableStatic ''
|
||||||
@ -49,8 +53,8 @@ stdenv.mkDerivation rec {
|
|||||||
${configParser}
|
${configParser}
|
||||||
cat << EOF | parseconfig
|
cat << EOF | parseconfig
|
||||||
${staticConfig}
|
${staticConfig}
|
||||||
${extraConfig}
|
|
||||||
${nixConfig}
|
${nixConfig}
|
||||||
|
${extraConfig}
|
||||||
$extraCrossConfig
|
$extraCrossConfig
|
||||||
EOF
|
EOF
|
||||||
make oldconfig
|
make oldconfig
|
||||||
|
Loading…
x
Reference in New Issue
Block a user