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 .PHONY: ghci ghci: shell.nix nix-shell --arg nixpkgs $(nixpkgs) --command 'exec ghci -Wall' $< .PHONY: result result: shell.nix nix-build --arg nixpkgs $(nixpkgs) $< shell.nix: $(wildcard *.cabal) cabal2nix --shell . > $@ .PHONY: update update: git -C .hstool fetch origin git -C .hstool reset --hard origin/master git -C .hstool clean -dfx