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