Use haskellSrc2nix over explicit cabal2nix
Use the (undocumented!) helper function haskellSrc2nix over having to explicitly run cabal2nix all the time when rebuilding
This commit is contained in:
		
							parent
							
								
									d3f3890dc5
								
							
						
					
					
						commit
						6eba471e24
					
				
					 5 changed files with 21 additions and 34 deletions
				
			
		|  | @ -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; } | ||||
|  |  | |||
							
								
								
									
										9
									
								
								nixpkgs.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								nixpkgs.nix
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,9 @@ | |||
| let | ||||
|   inherit (import <nixpkgs> {}) fetchFromGitHub; | ||||
|   nixpkgs = fetchFromGitHub { | ||||
|     owner  = "NixOS"; | ||||
|     repo   = "nixpkgs-channels"; | ||||
|     rev    = "54f385241e6649128ba963c10314942d73245479"; | ||||
|     sha256 = "0bd4v8v4xcdbaiaa59yqprnc6dkb9jv12mb0h5xz7b51687ygh9l"; | ||||
|   }; | ||||
| in import nixpkgs | ||||
							
								
								
									
										7
									
								
								pkg.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								pkg.nix
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,7 @@ | |||
| { nixpkgs ? import ./nixpkgs.nix {} }: | ||||
| let inherit (nixpkgs) pkgs; in | ||||
| import (pkgs.haskellPackages.haskellSrc2nix { | ||||
|   name = "xanthous"; | ||||
|   src = ./.; | ||||
|   extraCabal2nixOptions = "--hpack"; | ||||
| }) | ||||
|  | @ -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 | ||||
|  |  | |||
							
								
								
									
										29
									
								
								xanthous.nix
									
										
									
									
									
								
							
							
						
						
									
										29
									
								
								xanthous.nix
									
										
									
									
									
								
							|  | @ -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; | ||||
| } | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue