diff --git a/checks/lib/default.nix b/checks/lib/default.nix index e775f55..305818d 100644 --- a/checks/lib/default.nix +++ b/checks/lib/default.nix @@ -2,7 +2,7 @@ with lib; lib.runTests { testRakeLeaves = { - expr = importers.rakeLeaves ./profiles; + expr = rakeLeaves ./profiles; expected = { f = ./profiles/f.nix; foo = ./profiles/foo; @@ -13,7 +13,7 @@ lib.runTests { }; testFlattenTree = { - expr = importers.flattenTree (importers.rakeLeaves ./profiles); + expr = flattenTree (rakeLeaves ./profiles); expected = { f = ./profiles/f.nix; foo = ./profiles/foo; diff --git a/jobs/default.nix b/jobs/default.nix index c74e2ec..68237cd 100644 --- a/jobs/default.nix +++ b/jobs/default.nix @@ -7,7 +7,7 @@ let digga = inputs.digga; pkgs = import nixpkgs { inherit system; config = { }; overlays = [ ]; }; - docOptions = (digga.lib.mkFlake { self = {}; inputs = {};}).options; + docOptions = (digga.lib.mkFlake { self = { }; inputs = { }; }).options; evaledOptions = (pkgs.lib.evalModules { modules = [ docOptions ]; }).options; mkDocPartMd = part: title: intro: @@ -46,20 +46,20 @@ in ''; mkApiReferenceChannels = mkDocPartMd "channels" "Channels API Container" '' - Configure your channels that you can use throughout your configurations. + Configure your channels that you can use throughout your configurations. - > #### ⚠ Gotcha ⚠ - > Devshell & Home-Manager `pkgs` instances are rendered off the - > `nixos.hostDefaults.channelName` (default) channel. + > #### ⚠ Gotcha ⚠ + > Devshell & Home-Manager `pkgs` instances are rendered off the + > `nixos.hostDefaults.channelName` (default) channel. ''; mkApiReferenceDevshell = mkDocPartMd "devshell" "Devshell API Container" '' - Configure your devshell module collections of your environment. + Configure your devshell module collections of your environment. ''; mkApiReferenceHome = mkDocPartMd "home" "Home-Manager API Container" '' - Configure your home manager modules, profiles & suites. + Configure your home manager modules, profiles & suites. ''; mkApiReferenceNixos = mkDocPartMd "nixos" "NixOS API Container" '' - Configure your nixos modules, profiles & suites. + Configure your nixos modules, profiles & suites. ''; } diff --git a/modules/boostrap-iso.nix b/modules/boostrap-iso.nix index af5c551..ea96878 100644 --- a/modules/boostrap-iso.nix +++ b/modules/boostrap-iso.nix @@ -1,78 +1,87 @@ -{ self, fullHostConfig }: -{ config, lib, modulesPath, suites, ... }@args: { +let + protoModule = fullHostConfig: { config, lib, modulesPath, suites, self, ... }@args: { - imports = [ "${modulesPath}/installer/cd-dvd/installation-cd-minimal-new-kernel.nix" ]; - # avoid unwanted systemd service startups - disabledModules = - if (suites != null) - then - let - allProfiles = lib.foldl - (lhs: rhs: lhs ++ rhs) [ ] - (builtins.attrValues suites); - in - # we choose to satisfy the path contract of disabledModules - assert - lib.assertMsg - (builtins.all (p: lib.types.path.check p) allProfiles) - "all profiles used in suites must be paths"; - allProfiles - else - lib.warn '' - Any profiles that you have defined outside 'importables.suites' - will not be disabled on this ISO. That means services defined - there will unnessecarily launch on this installation medium. - '' [ ]; + imports = [ "${modulesPath}/installer/cd-dvd/installation-cd-minimal-new-kernel.nix" ]; + # avoid unwanted systemd service startups + disabledModules = + if (suites != null) + then + let + allProfiles = lib.foldl + (lhs: rhs: lhs ++ rhs) [ ] + (builtins.attrValues suites); + in + # we choose to satisfy the path contract of disabledModules + assert + lib.assertMsg + (builtins.all (p: lib.types.path.check p) allProfiles) + "all profiles used in suites must be paths"; + allProfiles + else + lib.warn '' + Any profiles that you have defined outside 'importables.suites' + will not be disabled on this ISO. That means services defined + there will unnessecarily launch on this installation medium. + '' [ ]; - nix.registry = lib.mapAttrs (n: v: { flake = v; }) self.inputs; + nix.registry = lib.mapAttrs (n: v: { flake = v; }) self.inputs; - isoImage.isoBaseName = "nixos-" + config.networking.hostName; - isoImage.contents = [{ - source = self; - target = "/devos/"; - }]; - isoImage.storeContents = [ - self.devShell.${config.nixpkgs.system} - # include also closures that are "switched off" by the - # above profile filter on the local config attribute - fullHostConfig.system.build.toplevel - ]; - # still pull in tools of deactivated profiles - environment.systemPackages = fullHostConfig.environment.systemPackages; + isoImage.isoBaseName = "nixos-" + config.networking.hostName; + isoImage.contents = [{ + source = self; + target = "/devos/"; + }]; + isoImage.storeContents = [ + self.devShell.${config.nixpkgs.system} + # include also closures that are "switched off" by the + # above profile filter on the local config attribute + fullHostConfig.system.build.toplevel + ]; + # still pull in tools of deactivated profiles + environment.systemPackages = fullHostConfig.environment.systemPackages; - # confilcts with networking.wireless which might be slightly - # more useful on a stick - networking.networkmanager.enable = lib.mkForce false; - # confilcts with networking.wireless - networking.wireless.iwd.enable = lib.mkForce false; + # confilcts with networking.wireless which might be slightly + # more useful on a stick + networking.networkmanager.enable = lib.mkForce false; + # confilcts with networking.wireless + networking.wireless.iwd.enable = lib.mkForce false; - # Set up a link-local boostrap network - # See also: https://github.com/NixOS/nixpkgs/issues/75515#issuecomment-571661659 - networking.usePredictableInterfaceNames = lib.mkForce true; # so prefix matching works - networking.useNetworkd = lib.mkForce true; - networking.useDHCP = lib.mkForce false; - networking.dhcpcd.enable = lib.mkForce false; - systemd.network = { - # https://www.freedesktop.org/software/systemd/man/systemd.network.html - networks."boostrap-link-local" = { - matchConfig = { - Name = "en* wl* ww*"; + # Set up a link-local boostrap network + # See also: https://github.com/NixOS/nixpkgs/issues/75515#issuecomment-571661659 + networking.usePredictableInterfaceNames = lib.mkForce true; # so prefix matching works + networking.useNetworkd = lib.mkForce true; + networking.useDHCP = lib.mkForce false; + networking.dhcpcd.enable = lib.mkForce false; + systemd.network = { + # https://www.freedesktop.org/software/systemd/man/systemd.network.html + networks."boostrap-link-local" = { + matchConfig = { + Name = "en* wl* ww*"; + }; + networkConfig = { + Description = "Link-local host bootstrap network"; + MulticastDNS = true; + LinkLocalAddressing = "ipv6"; + DHCP = "yes"; + }; + address = [ + # fall back well-known link-local for situations where MulticastDNS is not available + "fe80::47" # 47: n=14 i=9 x=24; n+i+x + ]; + extraConfig = '' + # Unique, yet stable. Based off the MAC address. + IPv6LinkLocalAddressGenerationMode = "eui64" + ''; }; - networkConfig = { - Description = "Link-local host bootstrap network"; - MulticastDNS = true; - LinkLocalAddressing = "ipv6"; - DHCP = "yes"; - }; - address = [ - # fall back well-known link-local for situations where MulticastDNS is not available - "fe80::47" # 47: n=14 i=9 x=24; n+i+x - ]; - extraConfig = '' - # Unique, yet stable. Based off the MAC address. - IPv6LinkLocalAddressGenerationMode = "eui64" - ''; }; }; +in +{ config, ... }: +{ + system.build = { + boostrapIso = (config.lib.digga.mkBuild + (protoModule config) + ).config.system.build.isoImage; + }; } diff --git a/modules/default.nix b/modules/default.nix index b869b1f..a2607aa 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -1,4 +1,4 @@ { nixConfig = import ./nix-config.nix; - bootstapIso = import ./boostrap-iso.nix; + bootstrapIso = import ./boostrap-iso.nix; } diff --git a/shell.nix b/shell.nix index 9886eb8..9c30e47 100644 --- a/shell.nix +++ b/shell.nix @@ -144,7 +144,7 @@ devshell.mkShell { (test "examples" "groupByConfig") (test "examples" "hmOnly") (test "examples" "all" // { command = "check-downstream && check-groupByConfig && check-hmOnly"; }) - (docs { package = pkgs.mdbook;}) + (docs { package = pkgs.mdbook; }) (docs makeDocs) ]; diff --git a/src/mkFlake/default.nix b/src/mkFlake/default.nix index a70c18f..299a9ea 100644 --- a/src/mkFlake/default.nix +++ b/src/mkFlake/default.nix @@ -15,7 +15,8 @@ let extraArgs = removeAttrs args (builtins.attrNames evaled.options); -in { +in +{ __functor = _: fupAdapter' { inherit (evaled) config; diff --git a/src/mkFlake/options.nix b/src/mkFlake/options.nix index 60072e9..f58b6bd 100644 --- a/src/mkFlake/options.nix +++ b/src/mkFlake/options.nix @@ -239,7 +239,7 @@ let Example: ``` importables = rec { - profiles = digga.lib.importers.rakeLeaves ./profiles; + profiles = digga.lib.rakeLeaves ./profiles; suites = with profiles; { }; } ```