From 0433a00636b6ce519eb1cd371c7c3567c1633b9b Mon Sep 17 00:00:00 2001 From: Tom Hubrecht Date: Thu, 6 Feb 2025 09:42:07 +0100 Subject: [PATCH] chore(bootstrap): Rename file --- sources.nix => bootstrap.nix | 27 +++++++++++---------------- default.nix | 8 ++++++-- hive.nix | 9 +++++---- keys.nix | 5 ++--- meta/verify.nix | 14 +++++++------- 5 files changed, 31 insertions(+), 32 deletions(-) rename sources.nix => bootstrap.nix (51%) diff --git a/sources.nix b/bootstrap.nix similarity index 51% rename from sources.nix rename to bootstrap.nix index 82bca84..efd42ca 100644 --- a/sources.nix +++ b/bootstrap.nix @@ -5,34 +5,29 @@ # SPDX-License-Identifier: EUPL-1.2 let - rawSources = import ./npins; + unpatchedSources = import ./npins; - bootstrapNixpkgs = import rawSources.nixos-unstable { }; + pkgs = import unpatchedSources.nixos-unstable { }; patch = (import ./lib/nix-patches { patchFile = ./patches; }).base { - pkgs = bootstrapNixpkgs; + inherit pkgs; }; - patchedSources = builtins.mapAttrs ( + sources = builtins.mapAttrs ( k: src: patch.applyPatches { inherit src; name = k; } - ) rawSources; + ) unpatchedSources; - libOverlay = final: _: { - extra = import ./lib/nix-lib { lib = final; }; - }; + overlays.lib = _: lib: { extra = import ./lib/nix-lib { inherit lib; }; }; in -patchedSources -// { - inherit - bootstrapNixpkgs - libOverlay - rawSources - ; +{ + inherit overlays sources unpatchedSources; - fullLib = bootstrapNixpkgs.lib.extend libOverlay; + pkgs = pkgs // { + lib = pkgs.lib.extend overlays.lib; + }; } diff --git a/default.nix b/default.nix index 97d6005..10a951e 100644 --- a/default.nix +++ b/default.nix @@ -3,9 +3,13 @@ # # SPDX-License-Identifier: EUPL-1.2 +let + bootstrap = import ./bootstrap.nix; +in + { - sources ? import ./sources.nix, - pkgs ? sources.bootstrapNixpkgs, + sources ? bootstrap.sources, + pkgs ? bootstrap.pkgs, }: let diff --git a/hive.nix b/hive.nix index 0332ca9..54b2c9e 100644 --- a/hive.nix +++ b/hive.nix @@ -9,12 +9,13 @@ let ### Init some tooling - sources = import ./sources.nix; - - lib = sources.fullLib; + bootstrap = import ./bootstrap.nix; + inherit (bootstrap.pkgs) lib; inherit (lib.extra) mapSingleFuse; + inherit (bootstrap) sources; + ### Let's build meta metadata = (import ./meta) lib; @@ -67,7 +68,7 @@ let # Function to create arguments based on the node # mkArgs = node: rec { - lib = sourcePkgs.lib.extend sources.libOverlay; + lib = sourcePkgs.lib.extend bootstrap.overlays.lib; sourcePkgs = nodePkgs node; meta = metadata; diff --git a/keys.nix b/keys.nix index 09779b4..2d8b05c 100644 --- a/keys.nix +++ b/keys.nix @@ -3,11 +3,10 @@ # SPDX-License-Identifier: EUPL-1.2 let - sources = import ./sources.nix; + bootstrap = import ./bootstrap.nix; - lib = sources.fullLib; + inherit (bootstrap.pkgs) lib; meta = (import ../meta lib).config; - in import ./lib/keys { inherit meta lib; } diff --git a/meta/verify.nix b/meta/verify.nix index 20205c0..621596d 100644 --- a/meta/verify.nix +++ b/meta/verify.nix @@ -6,10 +6,12 @@ # Nix expression to check if meta module is evaluating correctly. # To do so run `nix-build ./verify.nix` let - sources = import ../sources.nix; - pkgs = sources.bootstrapNixpkgs; + bootstrap = import ../bootstrap.nix; - dns = import sources."dns.nix" { inherit pkgs; }; + inherit (bootstrap) pkgs; + inherit (pkgs) lib; + + dns = import bootstrap.sources."dns.nix" { inherit pkgs; }; in { @@ -28,11 +30,9 @@ in pkgs.writers.writeJSON "meta.json" config; dns = dns.util.writeZone "dgnum.eu" ( - pkgs.lib.recursiveUpdate { SOA.serial = 0; } ( + lib.recursiveUpdate { SOA.serial = 0; } ( import ./dns.nix { - inherit dns; - - lib = sources.fullLib; + inherit dns lib; } ) );