mirror of
https://github.com/divnix/digga.git
synced 2024-12-23 08:02:21 +03:00
ref: adapt to fup upstream refactoring
This commit is contained in:
parent
6562558a4b
commit
0c266bafdf
@ -4,9 +4,8 @@
|
||||
let
|
||||
|
||||
nixpkgs = inputs.nixpkgs;
|
||||
diggalib = inputs.lib; # digga internals
|
||||
nixlib = inputs.nixlib;
|
||||
lib = nixlib // diggalib;
|
||||
digga = inputs.digga;
|
||||
lib = nixpkgs.lib // digga.lib;
|
||||
pkgs = import nixpkgs { inherit system; config = { }; overlays = [ ]; };
|
||||
|
||||
in
|
||||
|
113
deprecated.nix
Normal file
113
deprecated.nix
Normal file
@ -0,0 +1,113 @@
|
||||
{ lib, flake-utils-plus, internal-modules, importers, nixosModules }:
|
||||
let
|
||||
importers' = importers;
|
||||
in
|
||||
lib.warn ''
|
||||
You are accessing a deprecated item of the digga lib.
|
||||
Please update timely, it will be remove soon.
|
||||
''
|
||||
rec {
|
||||
|
||||
mkSuites = lib.warn ''
|
||||
Deprecated Function: mkSuites.
|
||||
''
|
||||
(
|
||||
{ suites, profiles }:
|
||||
let
|
||||
profileSet = lib.genAttrs' profiles (path: {
|
||||
name = baseNameOf path;
|
||||
value = mkProfileAttrs (toString path);
|
||||
});
|
||||
in
|
||||
lib.mapAttrs (_: v: lib.profileMap v) (suites profileSet)
|
||||
)
|
||||
;
|
||||
|
||||
mkProfileAttrs = lib.warn ''
|
||||
Deprecated Function: mkProfileAttrs.
|
||||
''
|
||||
(
|
||||
dir:
|
||||
let
|
||||
imports =
|
||||
let
|
||||
files = builtins.readDir dir;
|
||||
|
||||
p = n: v:
|
||||
v == "directory"
|
||||
&& n != "profiles";
|
||||
in
|
||||
lib.filterAttrs p files;
|
||||
|
||||
f = n: _:
|
||||
lib.optionalAttrs
|
||||
(lib.pathExists (dir + "/${n}/default.nix"))
|
||||
{ default = dir + "/${n}"; }
|
||||
// mkProfileAttrs (dir + "/${n}");
|
||||
in
|
||||
lib.mapAttrs f imports
|
||||
)
|
||||
;
|
||||
|
||||
profileMap =
|
||||
lib.warn ''
|
||||
Deprecated Function: profileMap.
|
||||
''
|
||||
(
|
||||
list: map (profile: profile.default) (lib.flatten list)
|
||||
)
|
||||
;
|
||||
|
||||
|
||||
exporters =
|
||||
lib.warn ''
|
||||
Deprecated Attribute Set: lib.exporters.
|
||||
|
||||
Please use export* functions instead:
|
||||
lib.exporters.modulesFromList -> lib.exportModules
|
||||
lib.exporters.fromOverlays -> lib.exportPackages
|
||||
lib.exporters.internalOverlays -> lib.exportOverlays
|
||||
''
|
||||
{
|
||||
modulesFromList = flake-utils-plus.exportModules;
|
||||
fromOverlays = flake-utils-plus.exportPackages;
|
||||
internalOverlays = flake-utils-plus.exportOverlays;
|
||||
}
|
||||
;
|
||||
|
||||
modules =
|
||||
lib.warn ''
|
||||
Deprecated Attribute Set: lib.modules.
|
||||
|
||||
Internal modules 'customBuilds', 'hmNixosDefaults' & 'globalDefaults'
|
||||
will be completely removed from the api soon.
|
||||
|
||||
Please use digga.nixosModules for exported modules or proto-modules:
|
||||
lib.modules.isoConfig -> nixosModules.boostrapIso
|
||||
''
|
||||
(
|
||||
internal-modules // { isoConfig = nixosModules.boostrapIso; }
|
||||
)
|
||||
;
|
||||
|
||||
importers =
|
||||
lib.warn ''
|
||||
Deprecated Attribute Set: lib.importers.
|
||||
|
||||
Please use import* functions instead:
|
||||
lib.importers.overlays -> lib.importOverlays
|
||||
lib.importers.modules -> lib.importModules
|
||||
lib.importers.hosts -> lib.importHosts
|
||||
lib.importers.rakeLeaves -> lib.rakeLeaves
|
||||
lib.importers.flattenTree -> lib.flattenTree
|
||||
''
|
||||
{
|
||||
overlays = importers'.importOverlays;
|
||||
modules = importers'.importModules;
|
||||
hosts = importers'.importHosts;
|
||||
rakeLeaves = importers'.rakeLeaves;
|
||||
flattenTree = importers'.flattenTree;
|
||||
}
|
||||
;
|
||||
|
||||
}
|
@ -1 +1 @@
|
||||
Subproject commit 19e73bc63448740b4c89e993555b82eb13062924
|
||||
Subproject commit c673440504250bbca93d69c6f404c7024568b430
|
46
flake.lock
46
flake.lock
@ -86,6 +86,27 @@
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils-plus": {
|
||||
"inputs": {
|
||||
"flake-utils": [
|
||||
"flake-utils"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1626825599,
|
||||
"narHash": "sha256-hgjuzvLE+jlt9z6k5MDbc0Fod4k5frZGnN7zArrlpd4=",
|
||||
"owner": "gytis-ivaskevicius",
|
||||
"repo": "flake-utils-plus",
|
||||
"rev": "ea46e02fb86785d3c883d658b194d69799386673",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "gytis-ivaskevicius",
|
||||
"ref": "staging",
|
||||
"repo": "flake-utils-plus",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"home-manager": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
@ -173,34 +194,13 @@
|
||||
"deploy": "deploy",
|
||||
"devshell": "devshell",
|
||||
"flake-utils": "flake-utils",
|
||||
"flake-utils-plus": "flake-utils-plus",
|
||||
"home-manager": "home-manager",
|
||||
"nixlib": [
|
||||
"nixpkgs"
|
||||
],
|
||||
"nixos-generators": "nixos-generators",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"utils": "utils"
|
||||
}
|
||||
},
|
||||
"utils": {
|
||||
"inputs": {
|
||||
"flake-utils": [
|
||||
"flake-utils"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1626288344,
|
||||
"narHash": "sha256-TioHDqWJkw37jjx4DVrH6LCzwrUfAqXbWl4rKR91fpA=",
|
||||
"owner": "gytis-ivaskevicius",
|
||||
"repo": "flake-utils-plus",
|
||||
"rev": "5c6ee69f6957afc2fe22c094717d6d78516418b5",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "gytis-ivaskevicius",
|
||||
"ref": "staging",
|
||||
"repo": "flake-utils-plus",
|
||||
"type": "github"
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
108
flake.nix
108
flake.nix
@ -18,7 +18,7 @@
|
||||
home-manager.inputs.nixpkgs.follows = "nixlib";
|
||||
|
||||
devshell.url = "github:numtide/devshell";
|
||||
utils.url = "github:gytis-ivaskevicius/flake-utils-plus/staging";
|
||||
flake-utils-plus.url = "github:gytis-ivaskevicius/flake-utils-plus/staging";
|
||||
|
||||
nixos-generators.url = "github:nix-community/nixos-generators";
|
||||
nixos-generators.inputs.nixpkgs.follows = "blank";
|
||||
@ -29,7 +29,7 @@
|
||||
# remove after https://github.com/NixOS/nix/pull/4641
|
||||
# and uncomment the poper lines using "utils/flake-utils" above
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
utils.inputs.flake-utils.follows = "flake-utils";
|
||||
flake-utils-plus.inputs.flake-utils.follows = "flake-utils";
|
||||
deploy.inputs.utils.follows = "flake-utils";
|
||||
nixos-generators.inputs.utils.follows = "flake-utils";
|
||||
# end ANTI CORRUPTION LAYER
|
||||
@ -41,45 +41,34 @@
|
||||
, nixpkgs
|
||||
, deploy
|
||||
, devshell
|
||||
, utils
|
||||
, flake-utils-plus
|
||||
, nixos-generators
|
||||
, home-manager
|
||||
, ...
|
||||
}@inputs:
|
||||
let
|
||||
|
||||
lib = nixlib.lib.makeExtensible (self:
|
||||
let combinedLib = nixlib.lib // self; in
|
||||
with self;
|
||||
utils.lib // {
|
||||
tests = import ./src/tests.nix { lib = combinedLib; };
|
||||
tests = import ./src/tests.nix { inherit (nixpkgs) lib; };
|
||||
|
||||
modules = import ./src/modules.nix {
|
||||
lib = combinedLib;
|
||||
inherit nixos-generators;
|
||||
};
|
||||
internal-modules = import ./src/modules.nix {
|
||||
inherit (nixpkgs) lib;
|
||||
inherit nixos-generators;
|
||||
};
|
||||
|
||||
importers = import ./src/importers.nix {
|
||||
lib = combinedLib;
|
||||
};
|
||||
importers = import ./src/importers.nix {
|
||||
inherit (nixpkgs) lib;
|
||||
};
|
||||
|
||||
generators = import ./src/generators.nix {
|
||||
lib = combinedLib;
|
||||
inherit deploy;
|
||||
};
|
||||
generators = import ./src/generators.nix {
|
||||
inherit (nixpkgs) lib;
|
||||
inherit deploy;
|
||||
};
|
||||
|
||||
mkFlake = import ./src/mkFlake {
|
||||
inherit deploy devshell home-manager;
|
||||
lib = combinedLib;
|
||||
};
|
||||
|
||||
inherit (attrs) mapFilterAttrs genAttrs' concatAttrs;
|
||||
inherit (lists) unifyOverlays;
|
||||
inherit (strings) rgxToString;
|
||||
inherit (importers) profileMap flattenTree rakeLeaves mkProfileAttrs maybeImportDevshellModule;
|
||||
inherit (generators) mkSuites mkDeployNodes mkHomeConfigurations;
|
||||
}
|
||||
);
|
||||
mkFlake = import ./src/mkFlake {
|
||||
inherit (nixpkgs) lib;
|
||||
inherit (flake-utils-plus.inputs) flake-utils;
|
||||
inherit deploy devshell home-manager flake-utils-plus internal-modules tests;
|
||||
};
|
||||
|
||||
# Unofficial Flakes Roadmap - Polyfills
|
||||
# .. see: https://demo.hedgedoc.org/s/_W6Ve03GK#
|
||||
@ -90,7 +79,7 @@
|
||||
ufrContract = import ./ufr-polyfills/ufrContract.nix;
|
||||
|
||||
# Dependency Groups - Style
|
||||
checksInputs = { inherit nixpkgs lib; nixlib = nixlib.lib; };
|
||||
checksInputs = { inherit nixpkgs; digga = self; };
|
||||
jobsInputs = { inherit nixpkgs; digga = self; };
|
||||
devShellInputs = { inherit nixpkgs devshell; };
|
||||
|
||||
@ -98,43 +87,36 @@
|
||||
# .. it's adopted by a growing number of projects.
|
||||
# Please consider adopting it if you want to help to improve flakes.
|
||||
|
||||
# DEPRECATED - will be removed timely
|
||||
deprecated = import ./deprecated.nix {
|
||||
inherit (nixpkgs) lib;
|
||||
inherit (self) nixosModules;
|
||||
inherit flake-utils-plus internal-modules importers;
|
||||
};
|
||||
|
||||
in
|
||||
|
||||
{
|
||||
# what you came for ...
|
||||
lib =
|
||||
let
|
||||
lib = {
|
||||
inherit (flake-utils-plus.inputs.flake-utils) defaultSystems eachSystem eachDefaultSystem filterPackages;
|
||||
inherit (flake-utils-plus) exportModules exportOverlays exportPackages;
|
||||
inherit mkFlake;
|
||||
inherit (tests) mkTest;
|
||||
inherit (importers) flattenTree rakeLeaves importOverlays importModules importHosts;
|
||||
inherit (generators) mkDeployNodes mkHomeConfigurations;
|
||||
|
||||
fupLib = with utils.lib; {
|
||||
# DEPRECATED - will be removed soon
|
||||
inherit (deprecated)
|
||||
mkSuites
|
||||
profileMap
|
||||
mkProfileAttrs
|
||||
exporters
|
||||
modules
|
||||
importers
|
||||
;
|
||||
|
||||
inherit
|
||||
systemFlake
|
||||
exporters
|
||||
;
|
||||
|
||||
};
|
||||
|
||||
diggaLib = with lib; {
|
||||
|
||||
inherit
|
||||
modules
|
||||
importers
|
||||
;
|
||||
|
||||
inherit (lib)
|
||||
mkFlake
|
||||
mkDeployNodes
|
||||
mkHomeConfigurations
|
||||
;
|
||||
|
||||
inherit (lib.tests)
|
||||
mkTest
|
||||
;
|
||||
|
||||
};
|
||||
|
||||
in
|
||||
fupLib // diggaLib;
|
||||
};
|
||||
|
||||
# a little extra service ...
|
||||
overlays = import ./overlays;
|
||||
|
78
modules/boostrap-iso.nix
Normal file
78
modules/boostrap-iso.nix
Normal file
@ -0,0 +1,78 @@
|
||||
{ self, fullHostConfig }:
|
||||
{ config, lib, modulesPath, suites, ... }@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.
|
||||
'' [ ];
|
||||
|
||||
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;
|
||||
|
||||
# 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*";
|
||||
};
|
||||
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"
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
|
@ -1,3 +1,4 @@
|
||||
{
|
||||
nixConfig = import ./nix-config.nix;
|
||||
bootstapIso = import ./boostrap-iso.nix;
|
||||
}
|
||||
|
@ -52,15 +52,4 @@
|
||||
}
|
||||
extraConfig)
|
||||
hosts;
|
||||
|
||||
# DEPRECATED, suites no longer needs an explicit function after the importables generalization
|
||||
# deprecation message for suites is already in evalArgs
|
||||
mkSuites = { suites, profiles }:
|
||||
let
|
||||
profileSet = lib.genAttrs' profiles (path: {
|
||||
name = baseNameOf path;
|
||||
value = lib.mkProfileAttrs (toString path);
|
||||
});
|
||||
in
|
||||
lib.mapAttrs (_: v: lib.profileMap v) (suites profileSet);
|
||||
}
|
||||
|
@ -113,60 +113,11 @@ let
|
||||
in
|
||||
lib.filterAttrs (n: v: v != { }) (lib.mapAttrs' collect files);
|
||||
|
||||
# DEPRECATED, prefer rakeLeaves
|
||||
mkProfileAttrs =
|
||||
/**
|
||||
Synopsis: mkProfileAttrs _path_
|
||||
Recursively collect the subdirs of _path_ containing a default.nix into attrs.
|
||||
This sets a contract, eliminating ambiguity for _default.nix_ living under the
|
||||
profile directory.
|
||||
Example:
|
||||
let profiles = mkProfileAttrs ./profiles; in
|
||||
assert profiles ? core.default; 0
|
||||
**/
|
||||
dir:
|
||||
let
|
||||
imports =
|
||||
let
|
||||
files = builtins.readDir dir;
|
||||
|
||||
p = n: v:
|
||||
v == "directory"
|
||||
&& n != "profiles";
|
||||
in
|
||||
lib.filterAttrs p files;
|
||||
|
||||
f = n: _:
|
||||
lib.optionalAttrs
|
||||
(lib.pathExists (dir + "/${n}/default.nix"))
|
||||
{ default = dir + "/${n}"; }
|
||||
// mkProfileAttrs (dir + "/${n}");
|
||||
in
|
||||
lib.mapAttrs f imports;
|
||||
|
||||
in
|
||||
{
|
||||
inherit rakeLeaves flattenTree;
|
||||
|
||||
mkProfileAttrs = builtins.trace ''
|
||||
The function, mkProfileAttrs, has been deprecated, you can now create profile sets
|
||||
with the standard importer, rakeLeaves. The formmat of rakeLeaves is a little different,
|
||||
because it doesn't recurse into directories with `default.nix` files in them. So some
|
||||
of your sub-profiles might no longer be collected. Make sure to update your profiles
|
||||
with that in mind;
|
||||
See https://github.com/divnix/digga/pull/29 for more details
|
||||
''
|
||||
mkProfileAttrs;
|
||||
|
||||
# DEPRECATED, both versions of `profileMap` are no longer necessary
|
||||
# paths are type-checked for suites in evalArgs
|
||||
# and `.default` isn't special with `rakeLeaves`
|
||||
/** profileMap = list: map
|
||||
(p: getProfilePath (throw "passed profile ${builtins.toJSON p} isn't a path") p)
|
||||
(lib.flatten list); **/
|
||||
profileMap = list: map (profile: profile.default) (lib.flatten list);
|
||||
|
||||
overlays = dir:
|
||||
importOverlays = dir:
|
||||
{
|
||||
# Meant to output a module that sets the overlays option
|
||||
# overlays order matters. mkAfter ensures those in-house
|
||||
@ -175,13 +126,13 @@ in
|
||||
overlays = lib.mkAfter (builtins.attrValues (flattenTree (rakeLeaves dir)));
|
||||
};
|
||||
|
||||
modules = dir:
|
||||
importModules = dir:
|
||||
{
|
||||
# Meant to output a module that sets the modules option
|
||||
modules = builtins.attrValues (flattenTree (rakeLeaves dir));
|
||||
};
|
||||
|
||||
hosts = dir:
|
||||
importHosts = dir:
|
||||
{
|
||||
# Meant to output a module that sets the hosts option (including constructed host names)
|
||||
hosts = lib.mapAttrs
|
||||
|
@ -1,4 +1,4 @@
|
||||
{ lib, deploy, devshell, home-manager } @ injectedDeps:
|
||||
{ lib, deploy, devshell, home-manager, flake-utils-plus, flake-utils, internal-modules, tests } @ injectedDeps:
|
||||
|
||||
{ self, inputs, ... } @ args:
|
||||
let
|
||||
@ -9,12 +9,7 @@ let
|
||||
fupAdapter' = import ./fup-adapter.nix injectedDeps';
|
||||
defaultOutputsBuilder' = import ./outputs-builder.nix injectedDeps';
|
||||
|
||||
evaled = lib.evalModules {
|
||||
modules = [
|
||||
args
|
||||
options'
|
||||
];
|
||||
};
|
||||
evaled = lib.evalModules { modules = [ args options' ]; };
|
||||
|
||||
defaultOutputsBuilder = defaultOutputsBuilder' evaled.config;
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
# constructor dependencies
|
||||
{ lib, ... }:
|
||||
{ lib, flake-utils-plus, internal-modules, ... }:
|
||||
|
||||
{
|
||||
# evaluated digga configuration
|
||||
@ -23,11 +23,11 @@ let
|
||||
];
|
||||
|
||||
defaultHostModules = [
|
||||
(lib.modules.hmNixosDefaults {
|
||||
(internal-modules.hmNixosDefaults {
|
||||
specialArgs = config.home.importables;
|
||||
modules = config.home.modules ++ config.home.externalModules;
|
||||
})
|
||||
(lib.modules.globalDefaults {
|
||||
(internal-modules.globalDefaults {
|
||||
self = config.self;
|
||||
hmUsers = config.home.users;
|
||||
})
|
||||
@ -40,7 +40,7 @@ let
|
||||
''
|
||||
{ });
|
||||
})
|
||||
lib.modules.customBuilds
|
||||
internal-modules.customBuilds
|
||||
];
|
||||
|
||||
unifyOverlays = channels: map (o: if builtins.isFunction (o null null) then o channels else o);
|
||||
@ -57,10 +57,12 @@ let
|
||||
"externalModules"
|
||||
];
|
||||
|
||||
in
|
||||
lib.systemFlake (lib.mergeAny
|
||||
{
|
||||
inherit (config) self inputs channelsConfig supportedSystems;
|
||||
diggaFupArgs = {
|
||||
inherit (config)
|
||||
self
|
||||
inputs
|
||||
channelsConfig
|
||||
supportedSystems;
|
||||
inherit sharedOverlays;
|
||||
|
||||
hosts = builtins.mapAttrs (_: stripHost) config.nixos.hosts;
|
||||
@ -74,18 +76,18 @@ lib.systemFlake (lib.mergeAny
|
||||
)
|
||||
config.channels;
|
||||
|
||||
hostDefaults = lib.mergeAny (stripHost config.nixos.hostDefaults) {
|
||||
hostDefaults = flake-utils-plus.lib.mergeAny (stripHost config.nixos.hostDefaults) {
|
||||
specialArgs = config.nixos.importables;
|
||||
modules = config.nixos.hostDefaults.externalModules ++ defaultHostModules;
|
||||
};
|
||||
|
||||
nixosModules = lib.exporters.modulesFromList config.nixos.hostDefaults.modules;
|
||||
nixosModules = flake-utils-plus.lib.exportModules config.nixos.hostDefaults.modules;
|
||||
|
||||
homeModules = lib.exporters.modulesFromList config.home.modules;
|
||||
homeModules = flake-utils-plus.lib.exportModules config.home.modules;
|
||||
|
||||
devshellModules = lib.exporters.modulesFromList config.devshell.modules;
|
||||
devshellModules = flake-utils-plus.lib.exportModules config.devshell.modules;
|
||||
|
||||
overlays = lib.exporters.internalOverlays {
|
||||
overlays = flake-utils-plus.lib.exporters.internalOverlays {
|
||||
# since we can't detect overlays owned by self
|
||||
# we have to filter out ones exported by the inputs
|
||||
# optimally we would want a solution for NixOS/nix#4740
|
||||
@ -94,8 +96,14 @@ lib.systemFlake (lib.mergeAny
|
||||
};
|
||||
|
||||
outputsBuilder = channels:
|
||||
lib.mergeAny (defaultOutputsBuilder channels) (config.outputsBuilder channels);
|
||||
flake-utils-plus.lib.mergeAny (defaultOutputsBuilder channels) (config.outputsBuilder channels);
|
||||
|
||||
}
|
||||
extraArgs # for overlays list order
|
||||
)
|
||||
};
|
||||
|
||||
in
|
||||
flake-utils-plus.lib.mkFlake
|
||||
(
|
||||
flake-utils-plus.lib.mergeAny
|
||||
diggaFupArgs
|
||||
extraArgs # for overlays list order
|
||||
)
|
||||
|
@ -1,5 +1,5 @@
|
||||
# constructor dependencies
|
||||
{ lib, devshell, self, inputs, ... }:
|
||||
{ lib, devshell, flake-utils, self, inputs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
@ -370,7 +370,7 @@ in
|
||||
};
|
||||
supportedSystems = mkOption {
|
||||
type = listOf str;
|
||||
default = lib.defaultSystems;
|
||||
default = flake-utils.lib.defaultSystems;
|
||||
description = ''
|
||||
The systems supported by this flake
|
||||
'';
|
||||
|
@ -1,5 +1,5 @@
|
||||
# constructor dependencies
|
||||
{ lib, deploy, devshell, home-manager, ... }:
|
||||
{ lib, deploy, devshell, home-manager, flake-utils-plus, tests, ... }:
|
||||
config: channels:
|
||||
let
|
||||
|
||||
@ -47,7 +47,7 @@ in
|
||||
|
||||
inherit homeConfigurationsPortable;
|
||||
|
||||
packages = lib.exporters.fromOverlays config.self.overlays channels;
|
||||
packages = flake-utils-plus.lib.exportPackages config.self.overlays channels;
|
||||
|
||||
devShell = (import devshell { inherit system pkgs; }).mkShell {
|
||||
name = lib.mkDefault config.nixos.hostDefaults.channelName;
|
||||
@ -115,7 +115,7 @@ in
|
||||
|
||||
createProfilesTestOp = n: host: {
|
||||
name = "allProfilesTestFor-${n}";
|
||||
value = lib.tests.profilesTest {
|
||||
value = tests.profilesTest {
|
||||
inherit host pkgs;
|
||||
};
|
||||
};
|
||||
|
@ -60,83 +60,5 @@
|
||||
|
||||
system.configurationRevision = lib.mkIf (self ? rev) self.rev;
|
||||
};
|
||||
|
||||
isoConfig = { self, fullHostConfig }:
|
||||
{ config, modulesPath, suites, ... }@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.
|
||||
'' [ ];
|
||||
|
||||
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;
|
||||
|
||||
# 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*";
|
||||
};
|
||||
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"
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user