mirror of
https://github.com/divnix/digga.git
synced 2024-12-23 08:02:21 +03:00
fix: boostrap iso module
This commit is contained in:
parent
fee8829dd7
commit
13d6f8590f
@ -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;
|
||||
|
@ -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.
|
||||
'';
|
||||
|
||||
}
|
||||
|
@ -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;
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
{
|
||||
nixConfig = import ./nix-config.nix;
|
||||
bootstapIso = import ./boostrap-iso.nix;
|
||||
bootstrapIso = import ./boostrap-iso.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)
|
||||
|
||||
];
|
||||
|
@ -15,7 +15,8 @@ let
|
||||
|
||||
extraArgs = removeAttrs args (builtins.attrNames evaled.options);
|
||||
|
||||
in {
|
||||
in
|
||||
{
|
||||
|
||||
__functor = _: fupAdapter' {
|
||||
inherit (evaled) config;
|
||||
|
@ -239,7 +239,7 @@ let
|
||||
Example:
|
||||
```
|
||||
importables = rec {
|
||||
profiles = digga.lib.importers.rakeLeaves ./profiles;
|
||||
profiles = digga.lib.rakeLeaves ./profiles;
|
||||
suites = with profiles; { };
|
||||
}
|
||||
```
|
||||
|
Loading…
Reference in New Issue
Block a user