depot: make version build faster
We don't need the entire depot to get the build version.
This commit is contained in:
parent
b2e2f965c5
commit
ea927a8c34
1 changed files with 14 additions and 1 deletions
15
version.nix
15
version.nix
|
@ -5,7 +5,20 @@
|
|||
{ pkgs, ... }:
|
||||
|
||||
let
|
||||
hgRepo = builtins.path { path = ./.hg; name = "depot-hg"; };
|
||||
inherit (pkgs) lib;
|
||||
inherit (builtins) elemAt match length;
|
||||
hgRelativePath = path: elemAt (match ".*/\\.hg/(.*)$" path) 0;
|
||||
hgDepth = path: length (lib.splitString "/" (hgRelativePath path));
|
||||
hgRepo = builtins.path {
|
||||
path = ./.hg;
|
||||
name = "depot-hg";
|
||||
filter = path: type: (type == "directory" && (
|
||||
hgRelativePath path == "store" ||
|
||||
hgRelativePath path == "merge" ||
|
||||
hgRelativePath path == "cache")) ||
|
||||
(type == "regular" && hgDepth path == 1) ||
|
||||
(type == "regular" && hgDepth path == 2);
|
||||
};
|
||||
changesetDeriv = pkgs.runCommandLocal "depot-version" {
|
||||
HG_REPO = hgRepo;
|
||||
MERCURIAL = pkgs.mercurial;
|
||||
|
|
Loading…
Reference in a new issue