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,
@ -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 {};