diff options
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | Gupfile | 4 | ||||
-rwxr-xr-x | all.gup | 16 | ||||
-rw-r--r-- | default.nix | 10 | ||||
-rwxr-xr-x | gup/cabal2nix.sh | 6 | ||||
-rw-r--r-- | shell.nix | 4 |
6 files changed, 36 insertions, 5 deletions
@@ -4,3 +4,4 @@ | |||
4 | **/dist/ | 4 | **/dist/ |
5 | **/.cabal-sandbox | 5 | **/.cabal-sandbox |
6 | /thermoprint.sqlite | 6 | /thermoprint.sqlite |
7 | **/.gup/ | ||
@@ -0,0 +1,4 @@ | |||
1 | gup/cabal2nix.sh: | ||
2 | !./default.nix | ||
3 | !./shell.nix | ||
4 | **/*.nix \ No newline at end of file | ||
@@ -0,0 +1,16 @@ | |||
1 | #!/usr/bin/env zsh | ||
2 | |||
3 | setopt EXTENDED_GLOB | ||
4 | |||
5 | typeset -a nixFiles | ||
6 | nixFiles=(**/(*~(default|shell)).nix(N)) | ||
7 | |||
8 | for f (${nixFiles}); do | ||
9 | [[ -e ${f:r}.cabal ]] && continue | ||
10 | nixFiles=("${(@)nixFiles:#${f}}") | ||
11 | done | ||
12 | |||
13 | print -l ${nixFiles} | gup --contents | ||
14 | for f (${nixFiles}); do | ||
15 | gup -u ${f} | ||
16 | done | ||
diff --git a/default.nix b/default.nix index 0aa8c9e..09e2b7b 100644 --- a/default.nix +++ b/default.nix | |||
@@ -3,8 +3,12 @@ | |||
3 | }: | 3 | }: |
4 | 4 | ||
5 | rec { | 5 | rec { |
6 | haskellPackages = pkgs.haskell.packages."${compilerName}"; | 6 | haskellPackages = pkgs.haskell.packages."${compilerName}".override { |
7 | threepenny-gui = pkgs.haskell.lib.appendPatch haskellPackages.threepenny-gui ./threepenny.patch; | 7 | overrides = self: super: with super; { |
8 | # threepenny-gui = pkgs.haskell.lib.appendPatch threepenny-gui ./threepenny.patch; | ||
9 | encoding = pkgs.haskell.lib.doJailbreak encoding; | ||
10 | }; | ||
11 | }; | ||
8 | thermoprint-spec = haskellPackages.callPackage ./spec/thermoprint-spec.nix {}; | 12 | thermoprint-spec = haskellPackages.callPackage ./spec/thermoprint-spec.nix {}; |
9 | thermoprint-bbcode = haskellPackages.callPackage ./tp-bbcode/thermoprint-bbcode.nix { | 13 | thermoprint-bbcode = haskellPackages.callPackage ./tp-bbcode/thermoprint-bbcode.nix { |
10 | inherit bbcode thermoprint-spec; | 14 | inherit bbcode thermoprint-spec; |
@@ -19,7 +23,7 @@ rec { | |||
19 | }; | 23 | }; |
20 | }; | 24 | }; |
21 | thermoprint-webgui = haskellPackages.callPackage ./webgui/thermoprint-webgui.nix { | 25 | thermoprint-webgui = haskellPackages.callPackage ./webgui/thermoprint-webgui.nix { |
22 | inherit thermoprint-bbcode thermoprint-client threepenny-gui; | 26 | inherit thermoprint-bbcode thermoprint-client; |
23 | }; | 27 | }; |
24 | tprint = haskellPackages.callPackage ./tprint/tprint.nix { | 28 | tprint = haskellPackages.callPackage ./tprint/tprint.nix { |
25 | inherit thermoprint-bbcode thermoprint-client; | 29 | inherit thermoprint-bbcode thermoprint-client; |
diff --git a/gup/cabal2nix.sh b/gup/cabal2nix.sh new file mode 100755 index 0000000..ba23c4e --- /dev/null +++ b/gup/cabal2nix.sh | |||
@@ -0,0 +1,6 @@ | |||
1 | #!/usr/bin/env zsh | ||
2 | |||
3 | gup -u ${2:r}.cabal | ||
4 | |||
5 | cd ${2:h} | ||
6 | cabal2nix ./. >! ${1} | ||
@@ -5,13 +5,13 @@ | |||
5 | let | 5 | let |
6 | thermoprintPackages = builtins.attrValues (import ./default.nix {}); | 6 | thermoprintPackages = builtins.attrValues (import ./default.nix {}); |
7 | ghc = haskellPackages.ghcWithPackages | 7 | ghc = haskellPackages.ghcWithPackages |
8 | (ps: thermoprintPackages ++ utilities ps ++ testDeps ps); | 8 | (ps: utilities ps ++ testDeps ps); |
9 | utilities = (ps: with ps; [ hlint cabal2nix ]); | 9 | utilities = (ps: with ps; [ hlint cabal2nix ]); |
10 | testDeps = (ps: with ps; [ temporary hspec ]); | 10 | testDeps = (ps: with ps; [ temporary hspec ]); |
11 | in | 11 | in |
12 | pkgs.stdenv.mkDerivation rec { | 12 | pkgs.stdenv.mkDerivation rec { |
13 | name = "thermoprint-env"; | 13 | name = "thermoprint-env"; |
14 | buildInputs = [ ghc ]; | 14 | buildInputs = (with pkgs; [ gup ]) ++ [ ghc ]; |
15 | shellHook = '' | 15 | shellHook = '' |
16 | eval $(egrep ^export ${ghc}/bin/ghc) | 16 | eval $(egrep ^export ${ghc}/bin/ghc) |
17 | export PROMPT_INFO="${name}" | 17 | export PROMPT_INFO="${name}" |