diff --git a/default.nix b/default.nix index f73c537ab..7cf9f4beb 100644 --- a/default.nix +++ b/default.nix @@ -1,8 +1,8 @@ -{ nixpkgs ? import {}, 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 000000000..19bf2c59c --- /dev/null +++ b/nixpkgs.nix @@ -0,0 +1,9 @@ +let + inherit (import {}) 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 000000000..d3b65a64f --- /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 aefc492d3..966ab0bb0 100644 --- a/shell.nix +++ b/shell.nix @@ -1,8 +1,8 @@ -{ nixpkgs ? import {}, 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 a10ed4830..000000000 --- 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 {}; - 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; -}