diff options
-rw-r--r-- | Makefile | 19 |
1 files changed, 17 insertions, 2 deletions
@@ -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 . > $@ |