From e9190e4dbb8f1490647be7441beae33ff20c066c Mon Sep 17 00:00:00 2001 From: Brian Picciano Date: Wed, 15 Feb 2023 15:09:31 +0100 Subject: [PATCH] Allow injecting bootstrap again, plus some additions to version --- default.nix | 36 +++++++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/default.nix b/default.nix index f0b952f..593360d 100644 --- a/default.nix +++ b/default.nix @@ -1,5 +1,3 @@ -# TODO -# - allow injecting a bootstrap file { buildSystem ? builtins.currentSystem, @@ -8,6 +6,8 @@ revision ? "", releaseName ? "debug", + bootstrap ? null, + }: let pkgsNix = (import ./nix/pkgs.nix); @@ -23,15 +23,16 @@ in rec { version = pkgs.stdenv.mkDerivation { name = "cryptic-net-version"; - inherit revision hostSystem releaseName; + inherit buildSystem revision releaseName; repoSrc = ./.; nativeBuildInputs = [ pkgs.git ]; - # TODO it'd be nice to be able to call `go version`, but that doesn't work - # when crossSystem is being used for some unknown reason. goVersion = pkgs.go.version; garageVersion = garageNix.version; + nixpkgsVersion = pkgsNix.version; + + release = "${releaseName}-${hostSystem}"; builder = builtins.toFile "builder.sh" '' source $stdenv/setup @@ -43,11 +44,12 @@ in rec { revision="$(cd repoSrcCp && git rev-parse HEAD)" fi - echo "Release $releaseName" >> "$versionFile" - echo "System: $hostSystem" >> "$versionFile" - echo "Git Revision: $revision" >> "$versionFile" - echo "Go Version: $goVersion" >> "$versionFile" - echo "Garage Version: $garageVersion" >> "$versionFile" + echo "Release $release" >> "$versionFile" + echo "Git Revision: $revision" >> "$versionFile" + echo "Go Version: $goVersion" >> "$versionFile" + echo "Garage Version: $garageVersion" >> "$versionFile" + echo "NixPkgs Version: $nixpkgsVersion" >> "$versionFile" + echo "Build Platform: $buildSystem" >> "$versionFile" mkdir -p "$out"/share cp "$versionFile" "$out"/share @@ -74,6 +76,18 @@ in rec { }; + rootedBootstrap = pkgs.stdenv.mkDerivation { + name = "cryptic-net-rooted-bootstrap"; + + src = bootstrap; + + builder = builtins.toFile "builder.sh" '' + source $stdenv/setup + mkdir -p "$out"/share + cp "$src" "$out"/share/bootstrap.yml + ''; + }; + appDir = pkgs.buildEnv { name = "cryptic-net-AppDir"; paths = [ @@ -86,7 +100,7 @@ in rec { pkgs.minio-client entrypoint - ]; + ] ++ (if bootstrap != null then [ rootedBootstrap ] else []); }; appimagetool = pkgs.callPackage ./nix/appimagetool.nix {};