Allow injecting bootstrap again, plus some additions to version

This commit is contained in:
Brian Picciano 2023-02-15 15:09:31 +01:00
parent 94c6ad8774
commit e9190e4dbb

View File

@ -1,5 +1,3 @@
# TODO
# - allow injecting a bootstrap file
{ {
buildSystem ? builtins.currentSystem, buildSystem ? builtins.currentSystem,
@ -8,6 +6,8 @@
revision ? "", revision ? "",
releaseName ? "debug", releaseName ? "debug",
bootstrap ? null,
}: let }: let
pkgsNix = (import ./nix/pkgs.nix); pkgsNix = (import ./nix/pkgs.nix);
@ -23,15 +23,16 @@ in rec {
version = pkgs.stdenv.mkDerivation { version = pkgs.stdenv.mkDerivation {
name = "cryptic-net-version"; name = "cryptic-net-version";
inherit revision hostSystem releaseName; inherit buildSystem revision releaseName;
repoSrc = ./.; repoSrc = ./.;
nativeBuildInputs = [ pkgs.git ]; 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; goVersion = pkgs.go.version;
garageVersion = garageNix.version; garageVersion = garageNix.version;
nixpkgsVersion = pkgsNix.version;
release = "${releaseName}-${hostSystem}";
builder = builtins.toFile "builder.sh" '' builder = builtins.toFile "builder.sh" ''
source $stdenv/setup source $stdenv/setup
@ -43,11 +44,12 @@ in rec {
revision="$(cd repoSrcCp && git rev-parse HEAD)" revision="$(cd repoSrcCp && git rev-parse HEAD)"
fi fi
echo "Release $releaseName" >> "$versionFile" echo "Release $release" >> "$versionFile"
echo "System: $hostSystem" >> "$versionFile"
echo "Git Revision: $revision" >> "$versionFile" echo "Git Revision: $revision" >> "$versionFile"
echo "Go Version: $goVersion" >> "$versionFile" echo "Go Version: $goVersion" >> "$versionFile"
echo "Garage Version: $garageVersion" >> "$versionFile" echo "Garage Version: $garageVersion" >> "$versionFile"
echo "NixPkgs Version: $nixpkgsVersion" >> "$versionFile"
echo "Build Platform: $buildSystem" >> "$versionFile"
mkdir -p "$out"/share mkdir -p "$out"/share
cp "$versionFile" "$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 { appDir = pkgs.buildEnv {
name = "cryptic-net-AppDir"; name = "cryptic-net-AppDir";
paths = [ paths = [
@ -86,7 +100,7 @@ in rec {
pkgs.minio-client pkgs.minio-client
entrypoint entrypoint
]; ] ++ (if bootstrap != null then [ rootedBootstrap ] else []);
}; };
appimagetool = pkgs.callPackage ./nix/appimagetool.nix {}; appimagetool = pkgs.callPackage ./nix/appimagetool.nix {};