chore(lib): Clean instanciation
Some checks failed
Check meta / check_dns (push) Successful in 16s
Check meta / check_meta (pull_request) Successful in 16s
Check meta / check_dns (pull_request) Successful in 16s
Check meta / check_meta (push) Successful in 17s
Check workflows / check_workflows (pull_request) Successful in 20s
Run pre-commit on all files / pre-commit (push) Successful in 25s
Build all the nodes / netcore02 (pull_request) Successful in 35s
Build all the nodes / ap01 (pull_request) Successful in 46s
Build the shell / build-shell (pull_request) Successful in 23s
Run pre-commit on all files / pre-commit (pull_request) Successful in 23s
Build all the nodes / hypervisor01 (pull_request) Successful in 2m49s
Build all the nodes / geo02 (pull_request) Successful in 2m52s
Build all the nodes / tower01 (pull_request) Successful in 2m45s
Build all the nodes / web03 (pull_request) Successful in 2m47s
Build all the nodes / bridge01 (pull_request) Successful in 3m11s
Build all the nodes / rescue01 (pull_request) Successful in 3m12s
Build all the nodes / hypervisor03 (pull_request) Successful in 3m16s
Build all the nodes / build01 (pull_request) Successful in 3m21s
Build all the nodes / storage01 (pull_request) Successful in 3m8s
Build all the nodes / vault01 (pull_request) Successful in 3m8s
Build all the nodes / geo01 (pull_request) Successful in 3m23s
Build all the nodes / web01 (pull_request) Successful in 3m50s
Build all the nodes / hypervisor02 (pull_request) Successful in 3m22s
Build all the nodes / web02 (pull_request) Successful in 3m8s
Build all the nodes / compute01 (pull_request) Failing after 8m45s

This commit is contained in:
sinavir 2025-01-09 14:52:51 +01:00
parent 9673287fb9
commit 1aac564ede
No known key found for this signature in database
6 changed files with 35 additions and 41 deletions

View file

@ -11,17 +11,9 @@ let
sources = import ./sources.nix;
inherit (sources) bootstrapNixpkgs;
lib = sources.fullLib;
lib = bootstrapNixpkgs.lib.extend (_: _: {
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;
inherit (lib.extra) mapSingleFuse;
### Let's build meta
metadata = (import ./meta) lib;
@ -46,7 +38,6 @@ let
};
};
# Build up the arguments to instantiate a nixpkgs given a system and a version.
mkNixpkgsConfig =
system:
@ -58,13 +49,12 @@ let
.${system} or (throw "Unknown system: ${system} for nixpkgs configuration instantiation");
# Instanciates the required nixpkgs version
mkSystemNixpkgs = system: version:
import sources."nixos-${version}" (mkNixpkgsConfig system version);
mkSystemNixpkgs =
system: version: import sources."nixos-${version}" (mkNixpkgsConfig system version);
# All supported nixpkgs versions × systems, instanciated
nixpkgs = mapSingleFuse (s: mapSingleFuse (mkSystemNixpkgs s) nixpkgs'.versions) nixpkgs'.systems;
# Get the configured nixos version for the node,
# defaulting to the one defined in meta/nixpkgs
version = node: metadata.nodes.${node}.nixpkgs.version;
@ -74,12 +64,10 @@ let
nodePkgs = node: nixpkgs.${system node}.${version node};
##########
# Function to create arguments based on the node
# Function to create arguments based on the node
#
mkArgs = node: rec {
lib = sourcePkgs.lib // {
extra = nix-lib;
};
lib = sourcePkgs.lib.extend sources.libOverlay;
sourcePkgs = nodePkgs node;
meta = metadata;

View file

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

View file

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

View file

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

View file

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

View file

@ -5,9 +5,9 @@
# SPDX-License-Identifier: EUPL-1.2
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 {
pkgs = bootstrapNixpkgs;
@ -19,5 +19,20 @@ let
inherit src;
name = k;
}
) sources';
in sources // { bootstrapNixpkgs = bootstrapNixpkgs; unpatchedSources = sources; }
) unpatchedSources;
libOverlay = final: _: {
extra = import ./lib/nix-lib { lib = final; };
};
in
sources
// {
inherit
bootstrapNixpkgs
libOverlay
unpatchedSources
;
fullLib = bootstrapNixpkgs.lib.extend libOverlay;
}