summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2017-04-30 14:34:39 +0200
committertv <tv@krebsco.de>2017-04-30 15:46:32 +0200
commit936ad5f12422e3d124ade90fae78f9ed0427fc7d (patch)
treeeba8cf47a94b5f532017e47274a683e361e79f31
parent14e952c60f5d39024fa754fd85f37abceef4787f (diff)
Makefile: make nixpkgs overridable
-rw-r--r--Makefile19
1 files changed, 17 insertions, 2 deletions
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 <stockholm>'
+endif
+
.PHONY: _default
_default: ghci
@@ -7,7 +22,7 @@ clean:
.PHONY: ghci
ghci: shell.nix
- nix-shell --arg nixpkgs 'import <stockholm>' --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 <stockholm>' ./shell.nix
+ nix-build --arg nixpkgs $(nixpkgs) ./shell.nix
shell.nix: $(wildcard *.cabal)
cabal2nix --shell . > $@