Fix and improve version string
This commit is contained in:
parent
5e399209b2
commit
9288d8cf48
21
default.nix
21
default.nix
@ -1,9 +1,13 @@
|
|||||||
{
|
{
|
||||||
|
|
||||||
pkgs ? (import ./nix/pkgs.nix).stable,
|
pkgsAttrs ? (import ./nix/pkgs.nix),
|
||||||
bootstrap ? null,
|
bootstrap ? null,
|
||||||
|
|
||||||
}: rec {
|
}: let
|
||||||
|
|
||||||
|
pkgs = pkgsAttrs.pkgs;
|
||||||
|
|
||||||
|
in rec {
|
||||||
|
|
||||||
rootedBootstrap = pkgs.stdenv.mkDerivation {
|
rootedBootstrap = pkgs.stdenv.mkDerivation {
|
||||||
name = "cryptic-net-rooted-bootstrap";
|
name = "cryptic-net-rooted-bootstrap";
|
||||||
@ -21,23 +25,30 @@
|
|||||||
name = "cryptic-net-version";
|
name = "cryptic-net-version";
|
||||||
|
|
||||||
buildInputs = [ pkgs.git pkgs.go ];
|
buildInputs = [ pkgs.git pkgs.go ];
|
||||||
|
|
||||||
src = ./.;
|
src = ./.;
|
||||||
inherit bootstrap;
|
inherit bootstrap;
|
||||||
|
nixPkgsVersion = pkgsAttrs.version;
|
||||||
|
nixPkgsRev = pkgsAttrs.rev;
|
||||||
|
builtByUser = builtins.getEnv "USER";
|
||||||
|
|
||||||
builder = builtins.toFile "builder.sh" ''
|
builder = builtins.toFile "builder.sh" ''
|
||||||
source $stdenv/setup
|
source $stdenv/setup
|
||||||
|
|
||||||
versionFile=version
|
versionFile=version
|
||||||
|
|
||||||
|
cp -r "$src" srcCp
|
||||||
|
|
||||||
if [ "$bootstrap" != "" ]; then
|
if [ "$bootstrap" != "" ]; then
|
||||||
hostName=$(tar -xzf "$bootstrap" --to-stdout ./hostname)
|
hostName=$(tar -xzf "$bootstrap" --to-stdout ./hostname)
|
||||||
echo "Built for host: $hostName" >> "$versionFile"
|
echo "Built for host: $hostName" >> "$versionFile"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Build date: $(date)" >> "$versionFile"
|
echo "Build date: $(date) ($(date +%s))" >> "$versionFile"
|
||||||
echo "Git status: $(cd "$src" && git describe --always --long --dirty=' (dirty)')" >> "$versionFile"
|
echo "Built by: $builtByUser" >> "$versionFile"
|
||||||
|
echo "Git rev: $(cd srcCp && git describe --always --long --dirty=' (dirty)')" >> "$versionFile"
|
||||||
echo "Go version: $(go version)" >> "$versionFile"
|
echo "Go version: $(go version)" >> "$versionFile"
|
||||||
echo "Build host info: $(uname -srvm)" >> "$versionFile"
|
echo "Nixpkgs version: $nixPkgsVersion ($nixPkgsRev)" >> "$versionFile"
|
||||||
|
|
||||||
mkdir -p "$out"/share
|
mkdir -p "$out"/share
|
||||||
cp "$versionFile" "$out"/share
|
cp "$versionFile" "$out"/share
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
|
|
||||||
pkgs ? (import ../nix/pkgs.nix).stable,
|
pkgs ? (import ../nix/pkgs.nix).pkgs,
|
||||||
|
|
||||||
}: pkgs.mkShell {
|
}: pkgs.mkShell {
|
||||||
name = "cryptic-net-build-docs";
|
name = "cryptic-net-build-docs";
|
||||||
|
12
nix/pkgs.nix
12
nix/pkgs.nix
@ -16,6 +16,7 @@ rec {
|
|||||||
|
|
||||||
in {
|
in {
|
||||||
|
|
||||||
|
go = prev.go_1_18;
|
||||||
buildGoModule = args: prev.buildGoModule (buildArgs // args);
|
buildGoModule = args: prev.buildGoModule (buildArgs // args);
|
||||||
buildGo118Module = args: prev.buildGo118Module (buildArgs // args);
|
buildGo118Module = args: prev.buildGo118Module (buildArgs // args);
|
||||||
|
|
||||||
@ -31,11 +32,14 @@ rec {
|
|||||||
|
|
||||||
];
|
];
|
||||||
|
|
||||||
stableSrc = fetchTarball {
|
version = "22-05";
|
||||||
name = "nixpkgs-22-05";
|
rev = "2aec372cdcd4d73b94863611fea70e0884270fdc";
|
||||||
url = "https://github.com/NixOS/nixpkgs/archive/2aec372cdcd4d73b94863611fea70e0884270fdc.tar.gz";
|
|
||||||
|
src = fetchTarball {
|
||||||
|
name = "nixpkgs-${version}";
|
||||||
|
url = "https://github.com/NixOS/nixpkgs/archive/${rev}.tar.gz";
|
||||||
sha256 = "1pbfhlh4v8l70p44gspsci3i6w0wk70vaisiawg3jhka2nxb8367";
|
sha256 = "1pbfhlh4v8l70p44gspsci3i6w0wk70vaisiawg3jhka2nxb8367";
|
||||||
};
|
};
|
||||||
|
|
||||||
stable = import stableSrc { inherit overlays; };
|
pkgs = import src { inherit overlays; };
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user