git.iko.soy/typeable/cabal2nix
on master help sign in
Extended Derivation type by a 'postInstall' field.

This is a hack, unfortunately, but it is a hack that we need to support 'ghc-mod', which needs some post-processing in order to work correctly. The proper solution to this mess is to implement Derivation as HList that can be extended in some object oriented fashion.

commit08494602c823b2dce3ce0468644b1a47efb257c3 authorPeter Simons <simons@cryp.to> dateSun 25 Mar 2012, 20:27 (15 years ago) parent3a1cdca
2 files changed+4
src/Cabal2Nix/Generate.hs+1 src/Distribution/NixOS/Derivation/Cabal.hs+3
src/Cabal2Nix/Generate.hs+1
@@ -27,6 +27,7 @@ cabal2nix cabal = normalize $ postProcess $ MkDerivation
2727 , configureFlags = []
2828 , cabalFlags = configureCabalFlags pkg
2929 , runHaddock = True
30+ , postInstall = ""
3031 , metaSection = Meta
3132 { homepage = Cabal.homepage descr
3233 , description = Cabal.synopsis descr
src/Distribution/NixOS/Derivation/Cabal.hs+3
@@ -52,6 +52,7 @@ data Derivation = MkDerivation
5252 , configureFlags :: [String]
5353 , cabalFlags :: FlagAssignment
5454 , runHaddock :: Bool
55+ , postInstall :: String
5556 , metaSection :: Meta
5657 }
5758 deriving (Show, Eq, Ord)
@@ -79,6 +80,7 @@ renderDerivation deriv = funargs (map text ("cabal" : inputs)) $$ vcat
7980 , listattr "pkgconfigDepends" (pkgConfDeps deriv)
8081 , onlyIf renderedFlags $ attr "configureFlags" $ doubleQuotes (sep renderedFlags)
8182 , boolattr "noHaddock" (not (runHaddock deriv)) (not (runHaddock deriv))
83+ , onlyIf (postInstall deriv) $ text (postInstall deriv)
8284 , disp (metaSection deriv)
8385 ]
8486 , rbrace <> rparen
@@ -118,6 +120,7 @@ parseDerivation buf
118120 , cabalFlags = []
119121 , runHaddock = case noHaddock of "true":[] -> False
120122 _ -> True
123+ , postInstall = ""
121124 , metaSection = Meta
122125 { homepage = ""
123126 , description = ""