git.iko.soy/typeable/cabal2nix
on master help sign in
nix-paths: add allow-relative-paths flag tp allow building on systems that don't have Nix
dd74ac4Peter Simons
.travis.yml+1−1
@@ -20,4 +20,4 @@ install:
20 - stack build --only-snapshot
20 - stack build --only-snapshot
21
21
22script:
22script:
23− - stack build --pedantic --test --haddock
23+ - stack build --pedantic --test --haddock --flag=nix-paths:allow-relative-paths
nix-paths/Setup.lhs+1−1
@@ -22,7 +22,7 @@
22> configure :: (GenericPackageDescription, HookedBuildInfo) -> ConfigFlags -> IO LocalBuildInfo
22> configure :: (GenericPackageDescription, HookedBuildInfo) -> ConfigFlags -> IO LocalBuildInfo
23> configure (gpd, hbi) flags = do
23> configure (gpd, hbi) flags = do
24> lbi' <- confHook simpleUserHooks (gpd, hbi) flags
24> lbi' <- confHook simpleUserHooks (gpd, hbi) flags
25−> let paths = [ (p, programPath pc) | p <- programs, Just pc <- [lookupProgram (simpleProgram p) (withPrograms lbi)] ]
25+> let paths = map (\p -> (p, maybe p programPath (lookupProgram (simpleProgram p) (withPrograms lbi)))) programs
26> descr = localPkgDescr lbi'
26> descr = localPkgDescr lbi'
27> lib = fromJust (library descr)
27> lib = fromJust (library descr)
28> libbi = libBuildInfo lib
28> libbi = libBuildInfo lib
nix-paths/nix-paths.cabal+10−1
@@ -17,9 +17,18 @@ source-repository head
17 type: git
17 type: git
18 location: https://github.com/nixos/cabal2nix
18 location: https://github.com/nixos/cabal2nix
19
19
20+flag allow-relative-paths
21+ description: If any of the required Nix tools are missing at
22+ build-time, compile a run-time @$PATH@ dependent
23+ variant of this library instead of failing. This is
24+ useful for test environment such as Travis-CI, which
25+ may not have Nix installed.
26+ default: False
27+
20library
28library
21 default-language: Haskell2010
29 default-language: Haskell2010
22 hs-source-dirs: src
30 hs-source-dirs: src
23 exposed-modules: Nix.Paths, Nix.FindFile
31 exposed-modules: Nix.Paths, Nix.FindFile
24 build-depends: base < 5, process
32 build-depends: base < 5, process
33+ if !flag(allow-relative-paths)
25− build-tools: nix-instantiate, nix-build, nix-env, nix-store
34+ build-tools: nix-instantiate, nix-build, nix-env, nix-store