git.iko.soy/typeable/cabal2nix
on master help sign in
Options: allow changing nixpkgs identifier function
7c0ef5bDomen Kožar
src/Cabal2nix.hs+3−2
@@ -62,9 +62,9 @@ data Options = Options
62 , optSystem :: Platform
62 , optSystem :: Platform
63 , optSubpath :: Maybe FilePath
63 , optSubpath :: Maybe FilePath
64 , optHackageSnapshot :: Maybe UTCTime
64 , optHackageSnapshot :: Maybe UTCTime
65+ , optNixpkgsIdentifier :: NixpkgsResolver
65 , optUrl :: String
66 , optUrl :: String
66 }
67 }
67− deriving (Show)
68
68
69options :: Parser Options
69options :: Parser Options
70options = Options
70options = Options
@@ -88,6 +88,7 @@ options = Options
88 <*> option (maybeReader parsePlatform) (long "system" <> help "host system (in either short Nix format or full LLVM style) to use when evaluating the Cabal file" <> value buildPlatform <> showDefaultWith display)
88 <*> option (maybeReader parsePlatform) (long "system" <> help "host system (in either short Nix format or full LLVM style) to use when evaluating the Cabal file" <> value buildPlatform <> showDefaultWith display)
89 <*> optional (strOption $ long "subpath" <> metavar "PATH" <> help "Path to Cabal file's directory relative to the URI (default is root directory)")
89 <*> optional (strOption $ long "subpath" <> metavar "PATH" <> help "Path to Cabal file's directory relative to the URI (default is root directory)")
90 <*> optional (option utcTimeReader (long "hackage-snapshot" <> help "hackage snapshot time, ISO format"))
90 <*> optional (option utcTimeReader (long "hackage-snapshot" <> help "hackage snapshot time, ISO format"))
91+ <*> pure (\i -> Just (binding # (i, path # [i])))
91 <*> strArgument (metavar "URI")
92 <*> strArgument (metavar "URI")
92
93
93-- | A parser for the date. Hackage updates happen maybe once or twice a month.
94-- | A parser for the date. Hackage updates happen maybe once or twice a month.
@@ -207,7 +208,7 @@ processPackage Options{..} pkg = do
207
208
208 deriv :: Derivation
209 deriv :: Derivation
209 deriv = withHpackOverrides $ fromGenericPackageDescription (const True)
210 deriv = withHpackOverrides $ fromGenericPackageDescription (const True)
210− (\i -> Just (binding # (i, path # [i])))
211+ optNixpkgsIdentifier
211 optSystem
212 optSystem
212 (unknownCompilerInfo optCompiler NoAbiTag)
213 (unknownCompilerInfo optCompiler NoAbiTag)
213 flags
214 flags