about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGriffin Smith <root@gws.fyi>2019-08-31T17·15-0400
committerGriffin Smith <root@gws.fyi>2019-08-31T17·15-0400
commit6eba471e2426e7e4e7d5c935e3ce973e13fd6b24 (patch)
treee7b41534bdd6b08fcd8c0e1c5444f3605e66cf09
parentd3f3890dc5408581eb6181125c871d1cf2c0e18f (diff)
Use haskellSrc2nix over explicit cabal2nix
Use the (undocumented!) helper function haskellSrc2nix over having to
explicitly run cabal2nix all the time when rebuilding
-rw-r--r--default.nix4
-rw-r--r--nixpkgs.nix9
-rw-r--r--pkg.nix7
-rw-r--r--shell.nix6
-rw-r--r--xanthous.nix29
5 files changed, 21 insertions, 34 deletions
diff --git a/default.nix b/default.nix
index f73c537abd43..7cf9f4beb451 100644
--- a/default.nix
+++ b/default.nix
@@ -1,8 +1,8 @@
-{ nixpkgs ? import <nixpkgs> {}, compiler ? "ghc865" }:
+{ nixpkgs ? import ./nixpkgs.nix {}, compiler ? "ghc865" }:
 let
   inherit (nixpkgs) pkgs;
   all-hies = import (fetchTarball "https://github.com/infinisil/all-hies/tarball/master") {};
   hie = all-hies.selection { selector = p: { inherit (p) ghc865; }; };
-  xanthous = pkgs.haskellPackages.callPackage ./xanthous.nix {};
+  xanthous = pkgs.haskellPackages.callPackage (import ./pkg.nix { inherit nixpkgs; }) {};
 in
 xanthous // { inherit hie; }
diff --git a/nixpkgs.nix b/nixpkgs.nix
new file mode 100644
index 000000000000..19bf2c59cedd
--- /dev/null
+++ b/nixpkgs.nix
@@ -0,0 +1,9 @@
+let
+  inherit (import <nixpkgs> {}) fetchFromGitHub;
+  nixpkgs = fetchFromGitHub {
+    owner  = "NixOS";
+    repo   = "nixpkgs-channels";
+    rev    = "54f385241e6649128ba963c10314942d73245479";
+    sha256 = "0bd4v8v4xcdbaiaa59yqprnc6dkb9jv12mb0h5xz7b51687ygh9l";
+  };
+in import nixpkgs
diff --git a/pkg.nix b/pkg.nix
new file mode 100644
index 000000000000..d3b65a64f337
--- /dev/null
+++ b/pkg.nix
@@ -0,0 +1,7 @@
+{ nixpkgs ? import ./nixpkgs.nix {} }:
+let inherit (nixpkgs) pkgs; in
+import (pkgs.haskellPackages.haskellSrc2nix {
+  name = "xanthous";
+  src = ./.;
+  extraCabal2nixOptions = "--hpack";
+})
diff --git a/shell.nix b/shell.nix
index aefc492d3d44..966ab0bb0857 100644
--- a/shell.nix
+++ b/shell.nix
@@ -1,8 +1,8 @@
-{ nixpkgs ? import <nixpkgs> {}, compiler ? "ghc865", withHoogle ? true }:
+{ nixpkgs ? import ./nixpkgs.nix {}, compiler ? "ghc865", withHoogle ? true }:
 let
   inherit (nixpkgs) pkgs;
 
-  xan = import ./xanthous.nix;
+  pkg = import ./pkg.nix { inherit nixpkgs; };
 
   packageSet = (
     if compiler == "default"
@@ -21,7 +21,7 @@ let
     else packageSet
   );
 
-  drv = haskellPackages.callPackage xan {};
+  drv = haskellPackages.callPackage pkg {};
 
   inherit (pkgs.haskell.lib) addBuildTools;
 in
diff --git a/xanthous.nix b/xanthous.nix
deleted file mode 100644
index a10ed48305bb..000000000000
--- a/xanthous.nix
+++ /dev/null
@@ -1,29 +0,0 @@
-{ mkDerivation, ascii-art-to-unicode, base, brick, classy-prelude
-, constraints, containers, data-default, deepseq, hpack, lens, mtl
-, QuickCheck, stdenv, tasty, tasty-hunit, tasty-quickcheck, vty
-}:
-let
-  pkgs = import <nixpkgs> {};
-  all-hies = import (fetchTarball "https://github.com/infinisil/all-hies/tarball/master") {};
-  hie = all-hies.selection { selector = p: { inherit (p) ghc865; }; };
-in
-mkDerivation {
-  pname = "xanthous";
-  version = "0.1.0.0";
-  src = ./.;
-  libraryHaskellDepends = [
-    ascii-art-to-unicode base brick classy-prelude constraints
-    containers data-default deepseq lens mtl QuickCheck vty
-  ];
-  libraryToolDepends = [ hpack ];
-  testHaskellDepends = [
-    ascii-art-to-unicode base brick classy-prelude constraints
-    containers data-default deepseq lens mtl QuickCheck tasty
-    tasty-hunit tasty-quickcheck
-  ];
-  executableSystemDepends = [ hie pkgs.cabal-install ];
-  preConfigure = "hpack";
-  homepage = "https://github.com/glittershark/xanthous#readme";
-  description = "A WIP TUI RPG";
-  license = stdenv.lib.licenses.gpl3;
-}