From 17621d6b14db1bf5d0e914f89f338be630cf92f9 Mon Sep 17 00:00:00 2001 From: Timothy DeHerrera Date: Mon, 1 Feb 2021 18:57:19 -0700 Subject: [PATCH] iso-cd: style cleanup (#2) --- flake.nix | 5 +--- lib/default.nix | 63 +++++++++++++++++++++++-------------------------- 2 files changed, 30 insertions(+), 38 deletions(-) diff --git a/flake.nix b/flake.nix index dc63d7ea..4eb56733 100644 --- a/flake.nix +++ b/flake.nix @@ -60,10 +60,7 @@ overlay = import ./pkgs; - lib = import ./lib { - inherit (nixos) lib; - inherit nixos; - }; + lib = import ./lib { inherit nixos; }; templates.flk.path = ./.; diff --git a/lib/default.nix b/lib/default.nix index 86d02423..b8890fb7 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -1,9 +1,9 @@ -{ lib, nixos, ... }: +{ nixos, ... }: let inherit (builtins) attrNames attrValues isAttrs readDir listToAttrs mapAttrs; - inherit (lib) fold filterAttrs hasSuffix mapAttrs' nameValuePair removeSuffix - recursiveUpdate genAttrs nixosSystem; + inherit (nixos.lib) fold filterAttrs hasSuffix mapAttrs' nameValuePair removeSuffix + recursiveUpdate genAttrs nixosSystem mkForce; # mapFilterAttrs :: # (name -> value -> bool ) @@ -56,37 +56,32 @@ in (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; - }; - } - ]; - } - ); + nixosSystem (args // { + modules = + let + modpath = "nixos/modules"; + cd = "installer/cd-dvd/installation-cd-minimal-new-kernel.nix"; + isoConfig = (nixosSystem + (args // { + modules = modules ++ [ + "${nixos}/${modpath}/${cd}" + ({ config, ... }: { + isoImage.isoBaseName = "nixos-" + config.networking.hostName; + # confilcts with networking.wireless which might be slightly + # more useful on a stick + networking.networkmanager.enable = mkForce false; + # confilcts with networking.wireless + networking.wireless.iwd.enable = mkForce false; + }) + ]; + })).config; + in + modules ++ [{ + system.build = { + iso = isoConfig.system.build.isoImage; + }; + }]; + }); nixosModules = let