chore(lib): Clean instanciation
Some checks failed
Check meta / check_dns (push) Successful in 16s
Check meta / check_meta (push) Failing after 16s
Check meta / check_meta (pull_request) Failing after 16s
Check workflows / check_workflows (pull_request) Successful in 17s
Check meta / check_dns (pull_request) Successful in 17s
Build all the nodes / netcore02 (pull_request) Successful in 23s
Run pre-commit on all files / pre-commit (push) Successful in 25s
Build all the nodes / build01 (pull_request) Failing after 36s
Build the shell / build-shell (pull_request) Successful in 24s
Run pre-commit on all files / pre-commit (pull_request) Successful in 26s
Build all the nodes / ap01 (pull_request) Successful in 58s
Build all the nodes / hypervisor01 (pull_request) Successful in 1m37s
Build all the nodes / hypervisor03 (pull_request) Successful in 1m41s
Build all the nodes / hypervisor02 (pull_request) Successful in 5m19s
Build all the nodes / geo02 (pull_request) Successful in 5m28s
Build all the nodes / geo01 (pull_request) Successful in 5m53s
Build all the nodes / tower01 (pull_request) Successful in 5m51s
Build all the nodes / compute01 (pull_request) Failing after 5m54s
Build all the nodes / web02 (pull_request) Successful in 5m40s
Build all the nodes / bridge01 (pull_request) Successful in 6m1s
Build all the nodes / web01 (pull_request) Successful in 5m54s
Build all the nodes / web03 (pull_request) Successful in 5m58s
Build all the nodes / rescue01 (pull_request) Successful in 6m14s
Build all the nodes / vault01 (pull_request) Successful in 6m7s
Build all the nodes / storage01 (pull_request) Failing after 6m45s

This commit is contained in:
sinavir 2025-01-09 14:52:51 +01:00
parent d39ef4f6f6
commit 121bbc4896
No known key found for this signature in database
6 changed files with 36 additions and 42 deletions

View file

@ -11,17 +11,9 @@ let
sources = import ./sources.nix; sources = import ./sources.nix;
inherit (sources) bootstrapNixpkgs; lib = sources.fullLib;
lib = bootstrapNixpkgs.lib.extend (_: _: { inherit (lib.extra) mapSingleFuse;
extra = import ./lib/nix-lib;
});
nix-lib = lib.extra; # TODO: Assess perf penalty of fixed point
# TODO same but using bootstrapnixpkgs for nix-lib instanciation
# original statement: import ./lib/nix-lib;
inherit (nix-lib) mapSingleFuse;
### Let's build meta ### Let's build meta
meta = (import ./meta) lib; meta = (import ./meta) lib;
@ -46,7 +38,6 @@ let
}; };
}; };
# Build up the arguments to instantiate a nixpkgs given a system and a version. # Build up the arguments to instantiate a nixpkgs given a system and a version.
mkNixpkgsConfig = mkNixpkgsConfig =
system: system:
@ -58,13 +49,12 @@ let
.${system} or (throw "Unknown system: ${system} for nixpkgs configuration instantiation"); .${system} or (throw "Unknown system: ${system} for nixpkgs configuration instantiation");
# Instanciates the required nixpkgs version # Instanciates the required nixpkgs version
mkSystemNixpkgs = system: version: mkSystemNixpkgs =
import sources."nixos-${version}" (mkNixpkgsConfig system version); system: version: import sources."nixos-${version}" (mkNixpkgsConfig system version);
# All supported nixpkgs versions × systems, instanciated # All supported nixpkgs versions × systems, instanciated
nixpkgs = mapSingleFuse (s: mapSingleFuse (mkSystemNixpkgs s) nixpkgs'.versions) nixpkgs'.systems; nixpkgs = mapSingleFuse (s: mapSingleFuse (mkSystemNixpkgs s) nixpkgs'.versions) nixpkgs'.systems;
# Get the configured nixos version for the node, # Get the configured nixos version for the node,
# defaulting to the one defined in meta/nixpkgs # defaulting to the one defined in meta/nixpkgs
version = node: meta.nodes.${node}.nixpkgs.version; version = node: meta.nodes.${node}.nixpkgs.version;
@ -77,9 +67,7 @@ let
# Function to create arguments based on the node # Function to create arguments based on the node
# #
mkArgs = node: rec { mkArgs = node: rec {
lib = sourcePkgs.lib // { lib = sourcePkgs.lib.extend sources.libOverlay;
extra = nix-lib;
};
sourcePkgs = nodePkgs node; sourcePkgs = nodePkgs node;
inherit meta; inherit meta;

View file

@ -3,11 +3,11 @@
# SPDX-License-Identifier: EUPL-1.2 # SPDX-License-Identifier: EUPL-1.2
let let
_sources = import ../npins; sources = import ./sources.nix;
inherit (import _sources.nixpkgs { }) lib; lib = sources.fullLib;
meta = (import ../meta lib).config; meta = (import ../meta lib).config;
in in
import ./lib/keys { inherit meta lib; } import ./lib/keys { inherit meta lib; }

View file

@ -6,7 +6,7 @@
{ meta, lib }: { meta, lib }:
let let
inherit (import ../nix-lib) setDefault unique; inherit (lib.extra) setDefault unique;
getAttr = lib.flip builtins.getAttr; getAttr = lib.flip builtins.getAttr;
in in

View file

@ -2,17 +2,13 @@
# SPDX-FileCopyrightText: 2024 Tom Hubrecht <tom.hubrecht@dgnum.eu> # SPDX-FileCopyrightText: 2024 Tom Hubrecht <tom.hubrecht@dgnum.eu>
# #
# SPDX-License-Identifier: EUPL-1.2 # SPDX-License-Identifier: EUPL-1.2
{ lib }:
let
# Reimplement optional functions
_optional =
default: b: value:
if b then value else default;
in
rec { rec {
inherit (import ./nixpkgs.nix) inherit (lib)
flip flip
optionals
optionalString
hasPrefix hasPrefix
recursiveUpdate recursiveUpdate
splitString splitString
@ -112,11 +108,8 @@ rec {
subAttrs = attrs: builtins.map (subAttr attrs); subAttrs = attrs: builtins.map (subAttr attrs);
optionalList = _optional [ ]; optionalList = optionals;
optionalAttrs = _optional { };
optionalString = _optional "";
/* /*
Same as fuseAttrs but using `lib.recursiveUpdate` to merge attribute Same as fuseAttrs but using `lib.recursiveUpdate` to merge attribute
sets together. sets together.

View file

@ -32,9 +32,7 @@ in
import ./dns.nix { import ./dns.nix {
inherit dns; inherit dns;
lib = pkgs.lib // { lib = sources.fullLib;
extra = import ../lib/nix-lib;
};
} }
) )
); );

View file

@ -5,9 +5,9 @@
# SPDX-License-Identifier: EUPL-1.2 # SPDX-License-Identifier: EUPL-1.2
let let
sources' = import ./npins; unpatchedSources = import ./npins;
bootstrapNixpkgs = import sources'.nixos-unstable { }; bootstrapNixpkgs = import unpatchedSources.nixos-unstable { };
patch = (import ./lib/nix-patches { patchFile = ./patches; }).base { patch = (import ./lib/nix-patches { patchFile = ./patches; }).base {
pkgs = bootstrapNixpkgs; pkgs = bootstrapNixpkgs;
@ -19,5 +19,20 @@ let
inherit src; inherit src;
name = k; name = k;
} }
) sources'; ) unpatchedSources;
in sources // { bootstrapNixpkgs = bootstrapNixpkgs; unpatchedSources = sources; }
libOverlay = final: _: {
extra = import ./lib/nix-lib { lib = final; };
};
in
sources
// {
inherit
bootstrapNixpkgs
libOverlay
unpatchedSources
;
fullLib = bootstrapNixpkgs.lib.extend libOverlay;
}