aboutsummaryrefslogtreecommitdiff
path: root/docker.nix
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2023-03-30 16:28:53 -0400
committerJohn Ericson <John.Ericson@Obsidian.Systems>2023-03-30 16:28:53 -0400
commitaa99005004bccc9be506a2a2f162f78bad4bcb41 (patch)
treeeeda5852bad75701d48776cd141bbc8f857480e0 /docker.nix
parentd381248ec0847cacd918480e83a99287f814456a (diff)
parent06d87b95bc751480d5961def9c0a21f557103625 (diff)
Merge remote-tracking branch 'upstream/master' into path-info
Also improve content-address.hh API docs.
Diffstat (limited to 'docker.nix')
-rw-r--r--docker.nix12
1 files changed, 11 insertions, 1 deletions
diff --git a/docker.nix b/docker.nix
index 203a06b53..52199af66 100644
--- a/docker.nix
+++ b/docker.nix
@@ -8,6 +8,7 @@
, extraPkgs ? []
, maxLayers ? 100
, nixConf ? {}
+, flake-registry ? null
}:
let
defaultPkgs = with pkgs; [
@@ -247,7 +248,16 @@ let
mkdir -p $out/bin $out/usr/bin
ln -s ${pkgs.coreutils}/bin/env $out/usr/bin/env
ln -s ${pkgs.bashInteractive}/bin/bash $out/bin/sh
- '';
+
+ '' + (lib.optionalString (flake-registry != null) ''
+ nixCacheDir="/root/.cache/nix"
+ mkdir -p $out$nixCacheDir
+ globalFlakeRegistryPath="$nixCacheDir/flake-registry.json"
+ ln -s ${flake-registry}/flake-registry.json $out$globalFlakeRegistryPath
+ mkdir -p $out/nix/var/nix/gcroots/auto
+ rootName=$(${pkgs.nix}/bin/nix --extra-experimental-features nix-command hash file --type sha1 --base32 <(echo -n $globalFlakeRegistryPath))
+ ln -s $globalFlakeRegistryPath $out/nix/var/nix/gcroots/auto/$rootName
+ '');
in
pkgs.dockerTools.buildLayeredImageWithNixDb {