summary refs log tree commit diff
path: root/fleet/hosts/trieste/build-from-git.nix
blob: f04ef48c744be7ede04a093572a8527160051149 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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 {}