summaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2017-05-02 21:51:07 +0200
committertv <tv@krebsco.de>2017-05-02 21:51:14 +0200
commit6312ce9800708eaf619ad0e93af3a224e09ce4de (patch)
treec6389d1b06b56ee5d2b62a659f904e472f655406 /Makefile
parentde13fa04339b8085d6b7bbdc1dd3ec31ec981701 (diff)
replace shell.nix by skeleton from much[1]
[1]: http://cgit.krebsco.de/much
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile36
1 files changed, 36 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..869ee4f
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,36 @@
+
+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
+
+.PHONY: clean
+clean:
+ @find * -type f \( -name \*.o -o -name \*.hi \) -exec rm -v \{\} \;
+
+.PHONY: ghci
+ghci: shell.nix
+ nix-shell --arg nixpkgs $(nixpkgs) --command 'exec ghci -Wall -fobject-code'
+
+.PHONY: install
+install:
+ $(error to install run "make result && nix-env -i ./result")
+
+.PHONY: result
+result: shell.nix
+ nix-build --arg nixpkgs $(nixpkgs) ./shell.nix
+
+shell.nix: $(wildcard *.cabal)
+ cabal2nix --shell . > $@