From 95ff01f8965fd3b09953c75d16c4e2e7af38aa41 Mon Sep 17 00:00:00 2001 From: aszlig Date: Wed, 18 Mar 2015 14:06:22 +0100 Subject: lib: Refactor kernel configuration into a module. This means, we don't have that lib directory anymore and also we're not doing text substitution on the kernel config but instead override the original attributes. However, this needs to be refactored even further, so we can use the NixOS kernel system, which allows for certain modules to require specific kernel features. That way we can automatically create a kernel config from the list of required features and we only need to set a specific base config instead of specifying the *full* kernel config. Signed-off-by: aszlig --- machines/aszlig/dnyarri-kconf.nix | 2 - machines/aszlig/dnyarri.nix | 119 ++++++++++++++++---------------------- machines/aszlig/mmrnmhrm.nix | 21 ++----- 3 files changed, 57 insertions(+), 85 deletions(-) (limited to 'machines/aszlig') diff --git a/machines/aszlig/dnyarri-kconf.nix b/machines/aszlig/dnyarri-kconf.nix index 368c155f..7e176541 100644 --- a/machines/aszlig/dnyarri-kconf.nix +++ b/machines/aszlig/dnyarri-kconf.nix @@ -745,8 +745,6 @@ "CONFIG_DEVTMPFS_MOUNT" = "y"; "CONFIG_FW_LOADER" = "y"; "CONFIG_FIRMWARE_IN_KERNEL" = "y"; - "CONFIG_EXTRA_FIRMWARE" = "@extra_firmware@"; - "CONFIG_EXTRA_FIRMWARE_DIR" = "@builtin_firmware@"; "CONFIG_ALLOW_DEV_COREDUMP" = "y"; "CONFIG_GENERIC_CPU_AUTOPROBE" = "y"; "CONFIG_DMA_SHARED_BUFFER" = "y"; diff --git a/machines/aszlig/dnyarri.nix b/machines/aszlig/dnyarri.nix index 89753820..9eb3a65e 100644 --- a/machines/aszlig/dnyarri.nix +++ b/machines/aszlig/dnyarri.nix @@ -1,18 +1,49 @@ -{ pkgs, ... }: +{ pkgs, lib, ... }: -with pkgs.lib; -with import ../../lib; +with lib; { vuizvui.user.aszlig.profiles.workstation.enable = true; nix.maxJobs = 8; - boot = let - patch51Name = "patch51.fw"; - kernelParams = [ "snd-hda-intel.patch=${patch51Name}" ]; + boot = { + kernelParams = [ "snd-hda-intel.patch=patch51.fw" ]; - patch51 = pkgs.writeText patch51Name '' + initrd = { + mdadmConf = '' + ARRAY /dev/md0 metadata=1.2 UUID=f5e9de04:89efc509:4e184fcc:166b0b67 + ARRAY /dev/md1 metadata=0.90 UUID=b85aa8be:cea0faf2:7abcbee8:eeae037b + ''; + luks.devices = [ + { name = "system_crypt"; + device = "/dev/md1"; + preLVM = true; + } + ]; + }; + + loader.grub.devices = [ + "/dev/disk/by-id/ata-ST31500541AS_5XW0AMNH" + "/dev/disk/by-id/ata-ST31500541AS_6XW0M217" + ]; + }; + + nixpkgs.config.virtualbox.enableExtensionPack = true; + + vuizvui.user.aszlig.system.kernel.enable = true; + vuizvui.user.aszlig.system.kernel.config = let + radeonFw = [ + "radeon/R600_rlc.bin" + "radeon/R700_rlc.bin" + "radeon/RV710_uvd.bin" + "radeon/RV710_smc.bin" + "radeon/RV730_smc.bin" + ]; + + extraFw = radeonFw ++ [ "patch51.fw" ]; + + patch51 = pkgs.writeText "patch51.fw" '' [codec] 0x10ec0889 0x80860033 2 @@ -36,69 +67,21 @@ with import ../../lib; auto ''; - radeonFW = [ - "radeon/R600_rlc.bin" - "radeon/R700_rlc.bin" - "radeon/RV710_uvd.bin" - "radeon/RV710_smc.bin" - "radeon/RV730_smc.bin" - ]; - - linuxVuizvui = pkgs.buildLinux { - inherit (pkgs.kernelSourceVuizvui) version src; - - kernelPatches = singleton pkgs.vuizvuiKernelPatches.bfqsched; - configfile = pkgs.substituteAll { - name = "vuizvui-with-firmware.kconf"; - src = generateKConf (import ./dnyarri-kconf.nix); - - extra_firmware = concatStringsSep " " (radeonFW ++ [ - "patch51.fw" - ]); - - builtin_firmware = pkgs.stdenv.mkDerivation { - name = "builtin-firmware"; - buildCommand = let - firmwareBasePath = "${pkgs.firmwareLinuxNonfree}/lib/firmware"; - in '' - mkdir -p "$out/radeon" - ${concatMapStrings (x: '' - cp -Lv -t "$out/radeon" "${firmwareBasePath}/${x}"; - '') radeonFW} - - cp "${patch51}" "$out/${patch51Name}" - ''; - }; - }; - allowImportFromDerivation = true; # XXX - }; - in rec { - kernelPackages = let - kpkgs = pkgs.recurseIntoAttrs - (pkgs.linuxPackagesFor linuxVuizvui kernelPackages); - virtualbox = kpkgs.virtualbox.override { - enableExtensionPack = true; - }; - in pkgs.recurseIntoAttrs (kpkgs // { inherit virtualbox; }); - inherit kernelParams; - - initrd = { - mdadmConf = '' - ARRAY /dev/md0 metadata=1.2 UUID=f5e9de04:89efc509:4e184fcc:166b0b67 - ARRAY /dev/md1 metadata=0.90 UUID=b85aa8be:cea0faf2:7abcbee8:eeae037b + in import ./dnyarri-kconf.nix // { + CONFIG_EXTRA_FIRMWARE = concatStringsSep " " extraFw; + CONFIG_EXTRA_FIRMWARE_DIR = pkgs.stdenv.mkDerivation { + name = "builtin-firmware"; + buildCommand = let + firmwareBasePath = "${pkgs.firmwareLinuxNonfree}/lib/firmware"; + in '' + mkdir -p "$out/radeon" + ${concatMapStrings (x: '' + cp -Lv -t "$out/radeon" "${firmwareBasePath}/${x}" + '') radeonFw} + + cp "${patch51}" "$out/patch51.fw" ''; - luks.devices = [ - { name = "system_crypt"; - device = "/dev/md1"; - preLVM = true; - } - ]; }; - - loader.grub.devices = [ - "/dev/disk/by-id/ata-ST31500541AS_5XW0AMNH" - "/dev/disk/by-id/ata-ST31500541AS_6XW0M217" - ]; }; networking.hostName = "dnyarri"; diff --git a/machines/aszlig/mmrnmhrm.nix b/machines/aszlig/mmrnmhrm.nix index e46a723b..11ec69f6 100644 --- a/machines/aszlig/mmrnmhrm.nix +++ b/machines/aszlig/mmrnmhrm.nix @@ -1,31 +1,22 @@ -{ pkgs, ... }: +{ pkgs, lib, ... }: -with pkgs.lib; -with import ../../lib; +with lib; { vuizvui.user.aszlig.profiles.workstation.enable = true; nix.maxJobs = 2; - boot = let - linuxVuizvui = pkgs.buildLinux { - inherit (pkgs.kernelSourceVuizvui) version src; - - kernelPatches = singleton pkgs.vuizvuiKernelPatches.bfqsched; - configfile = generateKConf (import ./mmrnmhrm-kconf.nix); - allowImportFromDerivation = true; - }; - in rec { - kernelPackages = pkgs.recurseIntoAttrs - (pkgs.linuxPackagesFor linuxVuizvui kernelPackages); - + boot = { loader.grub.devices = map (i: "/dev/disk/by-id/${i}") [ "ata-WDC_WD10EZEX-00BN5A0_WD-WCC3F5756955" "ata-WDC_WD10EZEX-00BN5A0_WD-WCC3F5790537" ]; }; + vuizvui.user.aszlig.system.kernel.enable = true; + vuizvui.user.aszlig.system.kernel.config = import ./mmrnmhrm-kconf.nix; + networking.hostName = "mmrnmhrm"; fileSystems = { -- cgit 1.4.1