From 6312ce9800708eaf619ad0e93af3a224e09ce4de Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 2 May 2017 21:51:07 +0200 Subject: replace shell.nix by skeleton from much[1] [1]: http://cgit.krebsco.de/much --- .gitignore | 5 +++++ Makefile | 36 ++++++++++++++++++++++++++++++++++++ shell.nix | 34 ---------------------------------- 3 files changed, 41 insertions(+), 34 deletions(-) create mode 100644 .gitignore create mode 100644 Makefile delete mode 100644 shell.nix diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c9d712d --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +*.hi +*.o +.graveyard +/dist +/shell.nix 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 ' +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 . > $@ diff --git a/shell.nix b/shell.nix deleted file mode 100644 index 1e27f23..0000000 --- a/shell.nix +++ /dev/null @@ -1,34 +0,0 @@ - -let - pname = "news"; - version = "1"; - - pkgs = nixpkgs // extrapkgs; - nixpkgs = import {}; - extrapkgs = { - }; - hsPkgs = pkgs.haskellPackages; - hsEnv = hsPkgs.ghcWithPackages (_hsPkgs: with _hsPkgs; - [ - irc - irc-client - feed - split - warp - wai-util - ]); -in - -pkgs.myEnvFun { - name = "${pname}-${version}"; - - buildInputs = with pkgs; [ - hsEnv - ]; - - extraCmds = with pkgs; '' - $(grep export ${hsEnv.outPath}/bin/ghc) - ''; -} - -# vim: set fdm=marker : -- cgit v1.2.3