From 8cb82a307ff248b276da03687c6a9f29855839c2 Mon Sep 17 00:00:00 2001 From: David Arnold Date: Wed, 27 Jan 2021 21:11:38 -0500 Subject: [PATCH] iso: move iso target to ./lib --- flake.nix | 1 + hosts/default.nix | 38 ++------------------------------------ lib/default.nix | 37 +++++++++++++++++++++++++++++++++++-- 3 files changed, 38 insertions(+), 38 deletions(-) diff --git a/flake.nix b/flake.nix index a5bdcb5..dc63d7e 100644 --- a/flake.nix +++ b/flake.nix @@ -62,6 +62,7 @@ lib = import ./lib { inherit (nixos) lib; + inherit nixos; }; templates.flk.path = ./.; diff --git a/hosts/default.nix b/hosts/default.nix index 8d6f060..addb3b2 100644 --- a/hosts/default.nix +++ b/hosts/default.nix @@ -9,48 +9,14 @@ , ... }: let - inherit (lib.flk) recImport; + inherit (lib.flk) recImport nixosSystemExtended; inherit (builtins) attrValues removeAttrs; unstableModules = [ ]; addToDisabledModules = [ ]; - libExt = lib.extend ( - final: prev: { - nixosSystemExtended = { modules, ... } @ args: - lib.nixosSystem (args // { - modules = - let - isoConfig = ( - import (nixos + "/nixos/lib/eval-config.nix") - ( - args // { - modules = modules ++ [ - (nixos + "/nixos/modules/installer/cd-dvd/installation-cd-minimal-new-kernel.nix") - ({ config, ... }: { - isoImage.isoBaseName = "nixos-" + config.networking.hostName; - networking.networkmanager.enable = lib.mkForce false; # confilcts with networking.wireless which might be slightly more useful on a stick - networking.wireless.iwd.enable = lib.mkForce false; # confilcts with networking.wireless - }) - ]; - } - ) - ).config; - in - modules ++ [ - { - system.build = { - iso = isoConfig.system.build.isoImage; - }; - } - ]; - } - ); - } - ); - config = hostName: - libExt.nixosSystemExtended { + nixosSystemExtended { inherit system; specialArgs = diff --git a/lib/default.nix b/lib/default.nix index f2f6a2b..86d0242 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -1,9 +1,9 @@ -{ lib, ... }: +{ lib, nixos, ... }: let inherit (builtins) attrNames attrValues isAttrs readDir listToAttrs mapAttrs; inherit (lib) fold filterAttrs hasSuffix mapAttrs' nameValuePair removeSuffix - recursiveUpdate genAttrs; + recursiveUpdate genAttrs nixosSystem; # mapFilterAttrs :: # (name -> value -> bool ) @@ -55,6 +55,39 @@ in nameValuePair ("") (null)) (readDir dir); + nixosSystemExtended = { modules, ... } @ args: + nixosSystem ( + args // { + modules = + let + isoConfig = ( + import (nixos + "/nixos/lib/eval-config.nix") + ( + args // { + modules = modules ++ [ + (nixos + "/nixos/modules/installer/cd-dvd/installation-cd-minimal-new-kernel.nix") + ( + { config, ... }: { + isoImage.isoBaseName = "nixos-" + config.networking.hostName; + networking.networkmanager.enable = lib.mkForce false; # confilcts with networking.wireless which might be slightly more useful on a stick + networking.wireless.iwd.enable = lib.mkForce false; # confilcts with networking.wireless + } + ) + ]; + } + ) + ).config; + in + modules ++ [ + { + system.build = { + iso = isoConfig.system.build.isoImage; + }; + } + ]; + } + ); + nixosModules = let # binary cache