mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-11-10 16:45:51 +03:00
Move CIFS support into a separate module
This commit is contained in:
parent
cf744cb715
commit
b7c543136a
@ -316,11 +316,12 @@
|
||||
./system/upstart/upstart.nix
|
||||
./tasks/cpu-freq.nix
|
||||
./tasks/encrypted-devices.nix
|
||||
./tasks/filesystems.nix
|
||||
./tasks/filesystems/btrfs.nix
|
||||
./tasks/filesystems/cifs.nix
|
||||
./tasks/filesystems/ext.nix
|
||||
./tasks/filesystems/f2fs.nix
|
||||
./tasks/filesystems/nfs.nix
|
||||
./tasks/filesystems.nix
|
||||
./tasks/filesystems/reiserfs.nix
|
||||
./tasks/filesystems/unionfs-fuse.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
|
||||
# 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,
|
||||
@ -62,7 +46,7 @@ let
|
||||
cp -pv ${pkgs.gcc.gcc}/lib*/libgcc_s.so.* $out/lib
|
||||
|
||||
# Copy BusyBox.
|
||||
cp -rvd ${busybox}/{bin,sbin} $out/
|
||||
cp -rvd ${pkgs.busybox}/{bin,sbin} $out/
|
||||
chmod -R u+w $out
|
||||
|
||||
# Copy some utillinux stuff.
|
||||
@ -91,11 +75,6 @@ let
|
||||
cp -v ${pkgs.kmod}/bin/kmod $out/bin/
|
||||
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}
|
||||
|
||||
# Strip binaries further than normal.
|
||||
|
@ -137,7 +137,7 @@ in
|
||||
system.fsPackages = [ pkgs.dosfstools ];
|
||||
|
||||
environment.systemPackages =
|
||||
[ pkgs.ntfs3g pkgs.cifs_utils pkgs.fuse ]
|
||||
[ pkgs.ntfs3g pkgs.fuse ]
|
||||
++ config.system.fsPackages;
|
||||
|
||||
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 = ''
|
||||
CONFIG_PREFIX "$out"
|
||||
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 ''
|
||||
@ -49,8 +53,8 @@ stdenv.mkDerivation rec {
|
||||
${configParser}
|
||||
cat << EOF | parseconfig
|
||||
${staticConfig}
|
||||
${extraConfig}
|
||||
${nixConfig}
|
||||
${extraConfig}
|
||||
$extraCrossConfig
|
||||
EOF
|
||||
make oldconfig
|
||||
|
Loading…
Reference in New Issue
Block a user