1
0
Fork 0
mirror of https://github.com/LnL7/nix-darwin.git synced 2025-03-28 18:57:08 +00:00

nix-gc: add check for nix.gc.automatic

This hopefully avoids problems for people that try to enable the service
with a single-user install.

Fixes #118
This commit is contained in:
Daiderd Jordan 2019-01-02 20:46:39 +01:00
parent f5116b0f4d
commit 72b3648fa0
No known key found for this signature in database
GPG key ID: D02435D05B810C96

View file

@ -134,6 +134,17 @@ let
exit 2
fi
'';
nixGarbageCollector = optionalString config.nix.gc.automatic ''
if test -O /nix/store; then
echo "error: A single-user install can't run gc as root, aborting activation" >&2
echo "Configure the garbage collector to run as the current user:" >&2
echo >&2
echo " nix.gc.user = \"$USER\";" >&2
echo >&2
exit 2
fi
'';
in
{
@ -147,6 +158,7 @@ in
${runLink}
${buildUsers}
${nixStore}
${nixGarbageCollector}
${nixChannels}
${nixInstaller}
${nixPath}