From 62c141c00631f31eec30448b14658dea513899c5 Mon Sep 17 00:00:00 2001 From: aszlig Date: Mon, 28 Jan 2013 22:34:41 +0100 Subject: Factor out kconf generator into lib/default.nix. This should get rid of the duplication already marked with XXX and of course should make the machine-specific configuration way easier to read. Signed-off-by: aszlig --- machines/mmrnmhrm.nix | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) (limited to 'machines/mmrnmhrm.nix') diff --git a/machines/mmrnmhrm.nix b/machines/mmrnmhrm.nix index ad875fd3..259d7c98 100644 --- a/machines/mmrnmhrm.nix +++ b/machines/mmrnmhrm.nix @@ -1,6 +1,7 @@ {config, pkgs, ...}: with pkgs.lib; +with import ../lib; { require = singleton ../common.nix; @@ -10,18 +11,7 @@ with pkgs.lib; version = pkgs.kernelSourceAszlig.version; src = pkgs.kernelSourceAszlig.src; - configfile = let - isNumber = c: elem c ["0" "1" "2" "3" "4" "5" "6" "7" "8" "9"]; - mkValue = val: - if val == "" then "\"\"" - else if val == "y" || val == "m" || val == "n" then val - else if all isNumber (stringToCharacters val) then val - else if substring 0 2 val == "0x" then val - else "\"${val}\""; - mkConfigLine = key: val: "${key}=${mkValue val}"; - mkConf = cfg: concatStringsSep "\n" (mapAttrsToList mkConfigLine cfg); - in pkgs.writeText "aszlig.kconf" (mkConf (import ./mmrnmhrm-kconf.nix)); - + configfile = generateKConf (import ./mmrnmhrm-kconf.nix); allowImportFromDerivation = true; }; in rec { -- cgit 1.4.1