git.iko.soy/typeable/cabal2nix
on master help sign in
Add the ability to specify extra function arguments expected by the

expression. This is useful for passing values that don't represent a package, i.e. that aren't added to buildInputs, etc.

commit3b8a862053ed90bfa3062b6b774b128d1f011948 authorPeter Simons <simons@cryp.to> dateTue 1 Apr 2014, 10:33 (13 years ago) parent73a96d7
2 files changed+4−1
src/Cabal2Nix/Generate.hs+1 src/Distribution/NixOS/Derivation/Cabal.hs+3−1
src/Cabal2Nix/Generate.hs+1
@@ -20,6 +20,7 @@ cabal2nix cabal = normalize $ postProcess MkDerivation
2020 , sha256 = "cabal2nix left the sha256 field undefined"
2121 , isLibrary = isJust (Cabal.library tpkg)
2222 , isExecutable = not (null (Cabal.executables tpkg))
23+ , extraFunctionArgs = []
2324 , buildDepends = map unDep deps
2425 , testDepends = map unDep tstDeps ++ concatMap Cabal.extraLibs tests
2526 , buildTools = map unDep tools
src/Distribution/NixOS/Derivation/Cabal.hs+3−1
@@ -46,6 +46,7 @@ data Derivation = MkDerivation
4646 , sha256 :: String
4747 , isLibrary :: Bool
4848 , isExecutable :: Bool
49+ , extraFunctionArgs :: [String]
4950 , buildDepends :: [String]
5051 , testDepends :: [String]
5152 , buildTools :: [String]
@@ -97,7 +98,7 @@ renderDerivation deriv = funargs (map text ("cabal" : inputs)) $$ vcat
9798 ]
9899 where
99100 inputs = nub $ sortBy (compare `on` map toLower) $ filter (/="cabal") $ filter (not . isPrefixOf "self.") $
100− buildDepends deriv ++ testDepends deriv ++ buildTools deriv ++ extraLibs deriv ++ pkgConfDeps deriv
101+ buildDepends deriv ++ testDepends deriv ++ buildTools deriv ++ extraLibs deriv ++ pkgConfDeps deriv ++ extraFunctionArgs deriv
101102 renderedFlags = [ text "-f" <> (if enable then empty else char '-') <> text f | (FlagName f, enable) <- cabalFlags deriv ]
102103 ++ map text (configureFlags deriv)
103104
@@ -124,6 +125,7 @@ parseDerivation buf
124125 , sha256 = sha
125126 , isLibrary = False
126127 , isExecutable = False
128+ , extraFunctionArgs = []
127129 , buildDepends = []
128130 , testDepends = []
129131 , buildTools = []