aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus S. Wamser <github-dev@mail2013.wamser.eu>2023-04-28 22:24:47 +0200
committerMarkus S. Wamser <github-dev@mail2013.wamser.eu>2023-05-16 14:35:31 +0200
commit908bc9a9574d31193b90e6c9ceb65d9622d4ed78 (patch)
treefd30f949fd18e3eb941b7d0fdedf3840c3036390
parent8976769a1c4a7fa6276d38402d97cec89b27d98f (diff)
fix "add an option to include flake-registry..."
commit 6dbce3215fa2e30e1daafcc70d6926cd97987612 was missing a pair of parentheses
-rw-r--r--docker.nix14
1 files changed, 10 insertions, 4 deletions
diff --git a/docker.nix b/docker.nix
index 52199af66..bd16b71cd 100644
--- a/docker.nix
+++ b/docker.nix
@@ -190,6 +190,12 @@ let
cp -a ${rootEnv}/* $out/
ln -s ${manifest} $out/manifest.nix
'';
+ flake-registry-path = if (flake-registry == null) then
+ null
+ else if (builtins.readFileType (toString flake-registry)) == "directory" then
+ "${flake-registry}/flake-registry.json"
+ else
+ flake-registry;
in
pkgs.runCommand "base-system"
{
@@ -202,7 +208,7 @@ let
];
allowSubstitutes = false;
preferLocalBuild = true;
- } ''
+ } (''
env
set -x
mkdir -p $out/etc
@@ -249,15 +255,15 @@ let
ln -s ${pkgs.coreutils}/bin/env $out/usr/bin/env
ln -s ${pkgs.bashInteractive}/bin/bash $out/bin/sh
- '' + (lib.optionalString (flake-registry != null) ''
+ '' + (lib.optionalString (flake-registry-path != null) ''
nixCacheDir="/root/.cache/nix"
mkdir -p $out$nixCacheDir
globalFlakeRegistryPath="$nixCacheDir/flake-registry.json"
- ln -s ${flake-registry}/flake-registry.json $out$globalFlakeRegistryPath
+ ln -s ${flake-registry-path} $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 {