about summary refs log tree commit diff
path: root/machines/dnyarri.nix
diff options
context:
space:
mode:
authoraszlig <aszlig@redmoonstudios.org>2013-01-28 22:34:41 +0100
committeraszlig <aszlig@redmoonstudios.org>2013-02-07 06:43:51 +0100
commit62c141c00631f31eec30448b14658dea513899c5 (patch)
treecea042891e8d36f669f800e72d8b73290faff01b /machines/dnyarri.nix
parent4fef01ea063354f095f5583c5d1fcedc967d9e87 (diff)
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 <aszlig@redmoonstudios.org>
Diffstat (limited to 'machines/dnyarri.nix')
-rw-r--r--machines/dnyarri.nix15
1 files changed, 2 insertions, 13 deletions
diff --git a/machines/dnyarri.nix b/machines/dnyarri.nix
index 3a3801a2..0c9f3bac 100644
--- a/machines/dnyarri.nix
+++ b/machines/dnyarri.nix
@@ -1,6 +1,7 @@
 {config, pkgs, ...}:
 
 with pkgs.lib;
+with import ../lib;
 
 {
   require = singleton ../common.nix;
@@ -43,19 +44,7 @@ with pkgs.lib;
       src = pkgs.kernelSourceAszlig.src;
       configfile = pkgs.substituteAll {
         name = "aszlig-with-firmware.kconf";
-
-        # XXX: in mmrnmhrm.nix as well, factor out!
-        src = 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 ./dnyarri-kconf.nix));
+        src = generateKConf (import ./dnyarri-kconf.nix);
 
         builtin_firmware = pkgs.stdenv.mkDerivation {
           name = "builtin-firmware";