ci: move into build attribute

This commit is contained in:
Timothy DeHerrera 2021-02-03 16:41:21 -07:00
parent 33f29d62f4
commit bd9878f82a
No known key found for this signature in database
GPG Key ID: 8985725DB5B0C122
4 changed files with 29 additions and 14 deletions

View File

@ -1,11 +0,0 @@
{ suites, ... }:
{
imports = with suites; allProfiles ++ allUsers;
security.mitigations.acceptRisk = true;
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
fileSystems."/" = { device = "/dev/disk/by-label/nixos"; };
}

View File

@ -63,7 +63,11 @@ let
system.configurationRevision = lib.mkIf (self ? rev) self.rev; system.configurationRevision = lib.mkIf (self ? rev) self.rev;
}; };
local = import "${toString ./.}/${hostName}.nix"; local = {
require = [
(import "${toString ./.}/${hostName}.nix")
];
};
# Everything in `./modules/list.nix`. # Everything in `./modules/list.nix`.
flakeModules = flakeModules =

View File

@ -1,7 +1,7 @@
{ nixos, ... }: { nixos, ... }:
let let
inherit (builtins) attrNames attrValues isAttrs readDir listToAttrs mapAttrs inherit (builtins) attrNames attrValues isAttrs readDir listToAttrs mapAttrs
pathExists; pathExists filter;
inherit (nixos.lib) fold filterAttrs hasSuffix mapAttrs' nameValuePair removeSuffix inherit (nixos.lib) fold filterAttrs hasSuffix mapAttrs' nameValuePair removeSuffix
recursiveUpdate genAttrs nixosSystem mkForce; recursiveUpdate genAttrs nixosSystem mkForce;
@ -76,6 +76,27 @@ in
let let
modpath = "nixos/modules"; modpath = "nixos/modules";
cd = "installer/cd-dvd/installation-cd-minimal-new-kernel.nix"; cd = "installer/cd-dvd/installation-cd-minimal-new-kernel.nix";
ciConfig =
(nixosSystem (args // {
modules =
let
# remove host module
modules' = filter (x: ! x ? require) modules;
in
modules' ++ [
({ suites, ... }: {
imports = with suites;
allProfiles ++ allUsers;
security.mitigations.acceptRisk = true;
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
fileSystems."/" = { device = "/dev/disk/by-label/nixos"; };
})
];
})).config;
isoConfig = (nixosSystem isoConfig = (nixosSystem
(args // { (args // {
modules = modules ++ [ modules = modules ++ [
@ -94,6 +115,7 @@ in
modules ++ [{ modules ++ [{
system.build = { system.build = {
iso = isoConfig.system.build.isoImage; iso = isoConfig.system.build.isoImage;
ci = ciConfig.system.build.toplevel;
}; };
}]; }];
}); });

View File

@ -11,7 +11,7 @@ let
}; };
ci = recurseIntoAttrs { ci = recurseIntoAttrs {
nixos = default.nixosConfigurations.ci.config.system.build.toplevel; nixos = default.nixosConfigurations.NixOS.config.system.build.ci;
}; };
in in
{ {