summaryrefslogtreecommitdiff
path: root/server/autobuild
diff options
context:
space:
mode:
authorYevhen Shymotiuk <yevhenshymotiuk@pm.me>2022-01-18 15:58:38 +0200
committerVedang Manerikar <ved.manerikar@gmail.com>2022-01-25 22:38:47 +0530
commit72ef774320d9eacd4d79b5016e9e989ab176afba (patch)
tree9a47ddc66bb747a31cf308e2d688e3adeee5b0f0 /server/autobuild
parent2ffd2cef9bd584cf64339055bd750afbcea937c1 (diff)
Fix: build on NixOS without nixpkgs in the Nix path
People who use [Nix Flakes](https://nixos.wiki/wiki/Flakes) do not usually have `nixpkgs` in their `NIX_PATH`, which leads to failed builds, because `nix-shell` relies on it. I suppose some users might not have `nixpkgs` in `NIX_PATH` for other reasons also. I propose to use [NixOS/nixpkgs](https://github.com/NixOS/nixpkgs) in such cases Merges, Closes: #72
Diffstat (limited to 'server/autobuild')
-rwxr-xr-xserver/autobuild4
1 files changed, 4 insertions, 0 deletions
diff --git a/server/autobuild b/server/autobuild
index b128e9d..e49a8b4 100755
--- a/server/autobuild
+++ b/server/autobuild
@@ -389,6 +389,10 @@ os_nixos() {
if [ -n "$DRY_RUN" ]; then
return 0
fi
+ if ! nix-instantiate --eval -E "<nixpkgs>" &>/dev/null; then
+ echo "File 'nixpkgs' was not found in the Nix path. Using NixOS/nixpkgs"
+ NIX_PATH="nixpkgs=https://github.com/nixos/nixpkgs/archive/master.tar.gz:$NIX_PATH"
+ fi
command="AUTOBUILD_NIX_SHELL=true"
command="$command;export AUTOBUILD_NIX_SHELL"
command="$command;$(quote "$0" "$@")"