From 591bd78509eb667d237d2be60ea33df11ab5468d Mon Sep 17 00:00:00 2001 From: Daniel Barlow Date: Mon, 26 Jun 2023 20:49:43 +0100 Subject: [PATCH] extract writeKconfig to its own file --- pkgs/kernel/default.nix | 13 ++++--------- pkgs/kernel/write-kconfig.nix | 11 +++++++++++ 2 files changed, 15 insertions(+), 9 deletions(-) create mode 100644 pkgs/kernel/write-kconfig.nix diff --git a/pkgs/kernel/default.nix b/pkgs/kernel/default.nix index bda49bf..0d69792 100644 --- a/pkgs/kernel/default.nix +++ b/pkgs/kernel/default.nix @@ -8,15 +8,10 @@ , src , extraPatchPhase ? "echo" } : -let writeConfig = name : config: writeText name - (builtins.concatStringsSep - "\n" - (lib.mapAttrsToList - (name: value: (if value == "n" then "# CONFIG_${name} is not set" else "CONFIG_${name}=${value}")) - config - )); - kconfigFile = writeConfig "kconfig" config; - inherit lib; in +let + writeConfig = import ./write-kconfig.nix { inherit lib writeText; }; + kconfigFile = writeConfig "kconfig" config; + inherit lib; in stdenv.mkDerivation rec { name = "kernel"; inherit src extraPatchPhase; diff --git a/pkgs/kernel/write-kconfig.nix b/pkgs/kernel/write-kconfig.nix new file mode 100644 index 0000000..7d064b2 --- /dev/null +++ b/pkgs/kernel/write-kconfig.nix @@ -0,0 +1,11 @@ +{ + lib +, writeText +}: +name : config: writeText name + (builtins.concatStringsSep + "\n" + (lib.mapAttrsToList + (name: value: (if value == "n" then "# CONFIG_${name} is not set" else "CONFIG_${name}=${value}")) + config + ))