From 936ad5f12422e3d124ade90fae78f9ed0427fc7d Mon Sep 17 00:00:00 2001 From: tv Date: Sun, 30 Apr 2017 14:34:39 +0200 Subject: Makefile: make nixpkgs overridable --- Makefile | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 978bf5f..869ee4f 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,18 @@ + +define newline + + +endef + +shell-quote = '$(subst $(newline),'\$(newline)',$(subst ','\'',$(1)))' + + +ifdef nixpkgs + override nixpkgs := $(call shell-quote,$(nixpkgs)) +else + nixpkgs = 'import ' +endif + .PHONY: _default _default: ghci @@ -7,7 +22,7 @@ clean: .PHONY: ghci ghci: shell.nix - nix-shell --arg nixpkgs 'import ' --command 'exec ghci -Wall -fobject-code' + nix-shell --arg nixpkgs $(nixpkgs) --command 'exec ghci -Wall -fobject-code' .PHONY: install install: @@ -15,7 +30,7 @@ install: .PHONY: result result: shell.nix - nix-build --arg nixpkgs 'import ' ./shell.nix + nix-build --arg nixpkgs $(nixpkgs) ./shell.nix shell.nix: $(wildcard *.cabal) cabal2nix --shell . > $@ -- cgit v1.2.3