about summary refs log tree commit diff
diff options
context:
space:
mode:
authorsterni <sternenseemann@systemli.org>2021-04-10T21·30+0200
committersterni <sternenseemann@systemli.org>2021-04-13T10·34+0000
commit2f4ea13ca2a76641052216139cc6267ca959ae0d (patch)
treeba3de13e19de1abb848c9bb8284bc2ea0e172436
parenta0cfa097e040f082d448288ca8a3c99231484b03 (diff)
refactor(users/grfn): build all haskell packages without ifd r/2501
Since we need to override random to 1.2.0 globally for xanthous
(otherwise propagation causes two versions of random to be propagated
for xanthous) evaluating haskell related stuff using import from
derivation can be very expensive since utilities like hpack and
cabal2nix need to be built for that. This means that for every channel
bump we potentially need to do a world rebuild of haskellPackages first.

To solve this we check in the cabal2nix-generated nix expressions for
owothia and xanthous.

Change-Id: I8fff70b4b6c303d1920f8bcac53520a09999b206
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2921
Tested-by: BuildkiteCI
Reviewed-by: grfn <grfn@gws.fyi>
Reviewed-by: tazjin <mail@tazj.in>
-rw-r--r--users/grfn/owothia/default.nix10
-rw-r--r--users/grfn/owothia/pkg.nix16
-rw-r--r--users/grfn/xanthous/default.nix30
-rw-r--r--users/grfn/xanthous/pkg.nix95
4 files changed, 126 insertions, 25 deletions
diff --git a/users/grfn/owothia/default.nix b/users/grfn/owothia/default.nix
index e10098ed94..b70d0525c1 100644
--- a/users/grfn/owothia/default.nix
+++ b/users/grfn/owothia/default.nix
@@ -2,5 +2,11 @@
 , pkgs ? depot.third_party.nixpkgs
 , ... }:
 
-pkgs.haskellPackages.callCabal2nix "owothia"
-  (depot.third_party.gitignoreSource ./.) { }
+let
+  basePkg = pkgs.haskellPackages.callPackage ./pkg.nix { };
+in
+
+pkgs.haskell.lib.overrideSrc basePkg {
+  src = depot.third_party.gitignoreSource ./.;
+  version = "canon";
+}
diff --git a/users/grfn/owothia/pkg.nix b/users/grfn/owothia/pkg.nix
new file mode 100644
index 0000000000..d0941a8489
--- /dev/null
+++ b/users/grfn/owothia/pkg.nix
@@ -0,0 +1,16 @@
+{ mkDerivation, base, bytestring, chatter, containers, envy
+, irc-client, lens, lib, random, relude, text
+}:
+mkDerivation {
+  pname = "owothia";
+  version = "0.0.1.0";
+  src = ./.;
+  isLibrary = false;
+  isExecutable = true;
+  executableHaskellDepends = [
+    base bytestring chatter containers envy irc-client lens random
+    relude text
+  ];
+  license = "unknown";
+  hydraPlatforms = lib.platforms.none;
+}
diff --git a/users/grfn/xanthous/default.nix b/users/grfn/xanthous/default.nix
index 0b89a50afb..1316ff583f 100644
--- a/users/grfn/xanthous/default.nix
+++ b/users/grfn/xanthous/default.nix
@@ -1,7 +1,23 @@
-{ pkgs ? (import ../../../. {}).third_party
-, lib ? pkgs.lib
-, ...
-}:
-pkgs.haskell.lib.failOnAllWarnings (
-  pkgs.haskellPackages.callPackage (import ./pkg.nix { inherit pkgs; }) {}
-)
+{ depot ? (import ../../../. {})
+, pkgs ? depot.third_party.nixpkgs
+, ... }:
+
+let
+  ignore = depot.third_party.gitignoreSource.gitignoreFilter ./.;
+  src = builtins.path {
+    name = "xanthous-source";
+    path = ./.;
+    filter = path: type: ignore path type
+      || builtins.baseNameOf path == "package.yaml";
+  };
+  # generated by cabal2nix
+  basePkg = pkgs.haskellPackages.callPackage ./pkg.nix { };
+in
+
+pkgs.haskell.lib.overrideCabal basePkg (default: {
+  inherit src;
+  version = "canon";
+  configureFlags = [
+    "--ghc-option=-Wall --ghc-option=-Werror"
+  ] ++ (default.configureFlags or []);
+})
diff --git a/users/grfn/xanthous/pkg.nix b/users/grfn/xanthous/pkg.nix
index 16a6500866..da5a5ba17e 100644
--- a/users/grfn/xanthous/pkg.nix
+++ b/users/grfn/xanthous/pkg.nix
@@ -1,16 +1,79 @@
-{ depot ? (import ../../../. {})
-, pkgs ? depot.third_party.nixpkgs
-, ... }:
-
-let
-  ignore = depot.third_party.gitignoreSource.gitignoreFilter ./.;
-in import (pkgs.haskellPackages.haskellSrc2nix {
-  name = "xanthous";
-  src = builtins.path {
-    name = "xanthous-source";
-    path = ./.;
-    filter = path: type: ignore path type
-      || builtins.baseNameOf path == "package.yaml";
-  };
-  extraCabal2nixOptions = "--hpack";
-})
+{ mkDerivation, aeson, array, async, base, bifunctors, brick
+, checkers, classy-prelude, comonad, comonad-extras, constraints
+, containers, criterion, data-default, deepseq, directory, fgl
+, fgl-arbitrary, file-embed, filepath, generic-arbitrary
+, generic-lens, generic-monoid, groups, hgeometry
+, hgeometry-combinatorial, hpack, JuicyPixels, lens
+, lens-properties, lib, lifted-async, linear, megaparsec, mmorph
+, monad-control, MonadRandom, mtl, optparse-applicative, parallel
+, parser-combinators, pointed, QuickCheck, quickcheck-instances
+, quickcheck-text, random, random-extras, random-fu, random-source
+, Rasterific, raw-strings-qq, reflection, semigroupoids, splitmix
+, stache, streams, tasty, tasty-hunit, tasty-quickcheck, text
+, text-zipper, tomland, transformers, vector, vty, witherable, yaml
+, zlib
+}:
+mkDerivation {
+  pname = "xanthous";
+  version = "0.1.0.0";
+  src = ./.;
+  isLibrary = true;
+  isExecutable = true;
+  libraryHaskellDepends = [
+    aeson array async base bifunctors brick checkers classy-prelude
+    comonad comonad-extras constraints containers criterion
+    data-default deepseq directory fgl fgl-arbitrary file-embed
+    filepath generic-arbitrary generic-lens generic-monoid groups
+    hgeometry hgeometry-combinatorial JuicyPixels lens lifted-async
+    linear megaparsec mmorph monad-control MonadRandom mtl
+    optparse-applicative parallel parser-combinators pointed QuickCheck
+    quickcheck-instances quickcheck-text random random-extras random-fu
+    random-source Rasterific raw-strings-qq reflection semigroupoids
+    splitmix stache streams text text-zipper tomland transformers
+    vector vty witherable yaml zlib
+  ];
+  libraryToolDepends = [ hpack ];
+  executableHaskellDepends = [
+    aeson array async base bifunctors brick checkers classy-prelude
+    comonad comonad-extras constraints containers criterion
+    data-default deepseq directory fgl fgl-arbitrary file-embed
+    filepath generic-arbitrary generic-lens generic-monoid groups
+    hgeometry hgeometry-combinatorial JuicyPixels lens lifted-async
+    linear megaparsec mmorph monad-control MonadRandom mtl
+    optparse-applicative parallel parser-combinators pointed QuickCheck
+    quickcheck-instances quickcheck-text random random-extras random-fu
+    random-source Rasterific raw-strings-qq reflection semigroupoids
+    splitmix stache streams text text-zipper tomland transformers
+    vector vty witherable yaml zlib
+  ];
+  testHaskellDepends = [
+    aeson array async base bifunctors brick checkers classy-prelude
+    comonad comonad-extras constraints containers criterion
+    data-default deepseq directory fgl fgl-arbitrary file-embed
+    filepath generic-arbitrary generic-lens generic-monoid groups
+    hgeometry hgeometry-combinatorial JuicyPixels lens lens-properties
+    lifted-async linear megaparsec mmorph monad-control MonadRandom mtl
+    optparse-applicative parallel parser-combinators pointed QuickCheck
+    quickcheck-instances quickcheck-text random random-extras random-fu
+    random-source Rasterific raw-strings-qq reflection semigroupoids
+    splitmix stache streams tasty tasty-hunit tasty-quickcheck text
+    text-zipper tomland transformers vector vty witherable yaml zlib
+  ];
+  benchmarkHaskellDepends = [
+    aeson array async base bifunctors brick checkers classy-prelude
+    comonad comonad-extras constraints containers criterion
+    data-default deepseq directory fgl fgl-arbitrary file-embed
+    filepath generic-arbitrary generic-lens generic-monoid groups
+    hgeometry hgeometry-combinatorial JuicyPixels lens lifted-async
+    linear megaparsec mmorph monad-control MonadRandom mtl
+    optparse-applicative parallel parser-combinators pointed QuickCheck
+    quickcheck-instances quickcheck-text random random-extras random-fu
+    random-source Rasterific raw-strings-qq reflection semigroupoids
+    splitmix stache streams text text-zipper tomland transformers
+    vector vty witherable yaml zlib
+  ];
+  prePatch = "hpack";
+  homepage = "https://github.com/glittershark/xanthous#readme";
+  description = "A WIP TUI RPG";
+  license = lib.licenses.gpl3Only;
+}