From 8f8585038dea4bbaa7c30734cd9a6ed1775a9c3c Mon Sep 17 00:00:00 2001 From: Tom Hubrecht Date: Mon, 14 Apr 2025 14:02:42 +0200 Subject: [PATCH] feat(bootstrap): Add the root of the repository This avoids making ../../.. in some places --- bootstrap.nix | 2 ++ machines/nixos/compute01/docuseal/default.nix | 4 +++- machines/nixos/compute01/extranix/default.nix | 12 ++++++------ 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/bootstrap.nix b/bootstrap.nix index 97954bc..9e324b6 100644 --- a/bootstrap.nix +++ b/bootstrap.nix @@ -27,6 +27,8 @@ in { inherit overlays sources unpatchedSources; + root = ./.; + pkgs = pkgs // { lib = pkgs.lib.extend overlays.lib; }; diff --git a/machines/nixos/compute01/docuseal/default.nix b/machines/nixos/compute01/docuseal/default.nix index 44c4e73..00cdbad 100644 --- a/machines/nixos/compute01/docuseal/default.nix +++ b/machines/nixos/compute01/docuseal/default.nix @@ -2,6 +2,8 @@ # # SPDX-License-Identifier: EUPL-1.2 +{ bootstrap, ... }: + let host = "docuseal.dgnum.eu"; port = 2500; @@ -12,7 +14,7 @@ in nixpkgs.overlays = [ (self: _: { - docuseal = self.callPackage ../../../../pkgs/by-name/docuseal { }; + docuseal = self.callPackage (bootstrap.root + "/pkgs/by-name/docuseal") { }; }) ]; diff --git a/machines/nixos/compute01/extranix/default.nix b/machines/nixos/compute01/extranix/default.nix index 95608f9..6dc35a9 100644 --- a/machines/nixos/compute01/extranix/default.nix +++ b/machines/nixos/compute01/extranix/default.nix @@ -5,13 +5,13 @@ { lib, meta, + bootstrap, sources, dgn-keys, ... }: let inherit (lib.extra) mkImports; - hive-root = ../../../..; host = "search.infra.dgnum.eu"; in { @@ -24,14 +24,14 @@ in enable = true; modules = { "netconf" = { - paths = mkImports hive-root [ + paths = mkImports bootstrap.root [ "modules/netconf" "modules/generic" "lib/netconf-junos" ]; path-translations = [ { - base = hive-root; + base = bootstrap.root; url = "https://git.dgnum.eu/DGNum/infrastructure/src/branch/main/"; } ]; @@ -39,11 +39,11 @@ in "DGNum Infrastructure" = let # prefer a non-patched nixpkgs - infra-nixpkgs = (import "${hive-root}/bootstrap.nix").pkgs; + infra-nixpkgs = bootstrap.pkgs; infra-modulesPath = "${infra-nixpkgs.path}/nixos/modules/"; in { - paths = mkImports hive-root [ + paths = mkImports bootstrap.root [ "modules/generic" "modules/nixos" ]; @@ -71,7 +71,7 @@ in }; path-translations = [ { - base = hive-root; + base = bootstrap.root; url = "https://git.dgnum.eu/DGNum/infrastructure/src/branch/main/"; } {