-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support for
cabal2nix
for IFD-free eval (#382)
If a `cabal.nix` file (customizable) exists, haskell-flake will use `callPackage` on it. This file should ideally be auto-managed by https://github.com/cachix/git-hooks.nix Note that IFD will still be needed if you override package sources (to source paths or to Hackage versions).
- Loading branch information
1 parent
f4e3cf1
commit d8a21e6
Showing
8 changed files
with
125 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ mkDerivation, base, lib, random }: | ||
mkDerivation { | ||
pname = "haskell-flake-test"; | ||
version = "0.1.0.0"; | ||
src = ./.; | ||
isLibrary = false; | ||
isExecutable = true; | ||
executableHaskellDepends = [ base random ]; | ||
license = "unknown"; | ||
mainProgram = "haskell-flake-test"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
{ | ||
# Disable IFD for this test. | ||
nixConfig = { | ||
allow-import-from-derivation = false; | ||
}; | ||
|
||
# Since there is no flake.lock file (to avoid incongruent haskell-flake | ||
# pinning), we must specify revisions for *all* inputs to ensure | ||
# reproducibility. | ||
inputs = { | ||
nixpkgs = { }; | ||
flake-parts = { }; | ||
haskell-flake = { }; | ||
}; | ||
|
||
outputs = inputs@{ self, nixpkgs, flake-parts, ... }: | ||
flake-parts.lib.mkFlake { inherit inputs; } { | ||
systems = nixpkgs.lib.systems.flakeExposed; | ||
imports = [ | ||
inputs.haskell-flake.flakeModule | ||
]; | ||
debug = true; | ||
perSystem = { config, self', pkgs, lib, ... }: { | ||
haskellProjects.default = { | ||
# If IFD is disabled, | ||
# we need to specify the pre-generated `cabal2nix` expressions | ||
# file to haskell-flake for the package, | ||
# otherwise build would fail as it would use `callCabal2nix` function | ||
# which uses IFD. | ||
packages.haskell-flake-test.cabal2NixFile = "default.nix"; | ||
settings = { }; | ||
}; | ||
}; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
cabal-version: 3.0 | ||
name: haskell-flake-test | ||
version: 0.1.0.0 | ||
license: NONE | ||
author: Joe | ||
maintainer: [email protected] | ||
build-type: Simple | ||
|
||
common warnings | ||
ghc-options: -Wall | ||
|
||
executable haskell-flake-test | ||
import: warnings | ||
main-is: Main.hs | ||
build-depends: | ||
base, | ||
random | ||
hs-source-dirs: src | ||
default-language: Haskell2010 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
module Main where | ||
|
||
import System.Random | ||
|
||
main :: IO () | ||
main = putStrLn "Hello, Haskell!" |