Skip to content

Commit

Permalink
iso: move iso target to ./lib
Browse files Browse the repository at this point in the history
  • Loading branch information
David Arnold committed Jan 28, 2021
1 parent 33bcf09 commit 8cb82a3
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 38 deletions.
1 change: 1 addition & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@

lib = import ./lib {
inherit (nixos) lib;
inherit nixos;
};

templates.flk.path = ./.;
Expand Down
38 changes: 2 additions & 36 deletions hosts/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down
37 changes: 35 additions & 2 deletions lib/default.nix
Original file line number Diff line number Diff line change
@@ -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 )
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 8cb82a3

Please sign in to comment.