From ef6eb092f98338bfed3220213d0dea830b7571e2 Mon Sep 17 00:00:00 2001 From: Luke Granger-Brown Date: Mon, 11 Jan 2021 17:17:16 +0000 Subject: [PATCH] depot: add version attribute which is the current changeset --- default.nix | 2 ++ version.nix | 17 +++++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 version.nix diff --git a/default.nix b/default.nix index 805f49b9f1..cf9e3cb1fa 100644 --- a/default.nix +++ b/default.nix @@ -21,6 +21,8 @@ in fix (self: web = import ./web ch; go = import ./go ch; + version = import ./version.nix ch; + lib = self.third_party.nixpkgs.lib; pkgs = self.third_party.nixpkgs // self.nix.pkgs; diff --git a/version.nix b/version.nix new file mode 100644 index 0000000000..a5a062b769 --- /dev/null +++ b/version.nix @@ -0,0 +1,17 @@ +{ pkgs, ... }: + +let + hgRepo = builtins.path { path = ./.hg; name = "depot-hg"; }; + changesetDeriv = pkgs.runCommandLocal "depot-version" { + HG_REPO = hgRepo; + MERCURIAL = pkgs.mercurial; + } '' + mytmp=$(mktemp -d) + pushd $mytmp + ln -s $HG_REPO .hg + echo -n "depot-$($MERCURIAL/bin/hg id --id | tr -d '+')" > $out + popd + rm -rf $mytmp + ''; +in + builtins.readFile changesetDeriv