summary refs log tree commit diff
path: root/fleet/hosts/trieste/build-from-git.nix
diff options
context:
space:
mode:
authorV <v@unfathomable.blue>2021-06-09 15:43:16 +0200
committerV <v@unfathomable.blue>2021-08-17 03:09:34 +0200
commitec0965e2672899d25a5a3a8c072de3ea734076a2 (patch)
treeddf53e6cc5ae47fa1a925f7a7d6414ba03718a84 /fleet/hosts/trieste/build-from-git.nix
parentdb7c54f92f386a94db8af7a12626d2657b4dd640 (diff)
fleet: init
Co-authored-by: edef <edef@unfathomable.blue>
Change-Id: I36d2c4cca542ed91630b1b832f3c7a7b97b33c65
Diffstat (limited to 'fleet/hosts/trieste/build-from-git.nix')
-rw-r--r--fleet/hosts/trieste/build-from-git.nix16
1 files changed, 16 insertions, 0 deletions
diff --git a/fleet/hosts/trieste/build-from-git.nix b/fleet/hosts/trieste/build-from-git.nix
new file mode 100644
index 0000000..f04ef48
--- /dev/null
+++ b/fleet/hosts/trieste/build-from-git.nix
@@ -0,0 +1,16 @@
+# SPDX-FileCopyrightText: V <v@unfathomable.blue>
+# SPDX-License-Identifier: OSL-3.0
+
+{ repo, pkgs ? import <nixpkgs> {} }:
+
+pkgs.callPackage (builtins.fetchGit {
+  url = repo;
+  # While Nix will happily just fetch from HEAD if you only pass in a
+  # path, it will also cache the result for an hour, making it totally
+  # unsuitable for what we're doing. lib.commitIdFromGitRepo, on the
+  # other hand, is implemented purely in Nix and does not cache lookups
+  # from one invocation to the next. This lets us "impurely" fetch from
+  # HEAD while enjoying the niceties of using builtins.fetchGit with a
+  # specific commit hash.
+  rev = pkgs.lib.commitIdFromGitRepo repo;
+}).outPath {}