cabal2nix 2.17.0 → 2.18.0
raw patch · 13 files changed
+155/−76 lines, 13 filesdep ~distribution-nixpkgsnew-uploaderPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: distribution-nixpkgs
API changes (from Hackage documentation)
- Distribution.Nixpkgs.Haskell.OrphanInstances: instance Data.Aeson.Types.FromJSON.FromJSON Distribution.Types.Dependency.Dependency
- Distribution.Nixpkgs.Haskell.OrphanInstances: instance Data.String.IsString Distribution.Types.Dependency.Dependency
+ Distribution.Nixpkgs.Haskell.Constraint: constraintPkgName :: Constraint -> PackageName
+ Distribution.Nixpkgs.Haskell.FromCabal.Configuration: instance GHC.Base.Semigroup Distribution.Nixpkgs.Haskell.FromCabal.Configuration.Configuration
+ Distribution.Nixpkgs.Haskell.OrphanInstances: instance Data.Aeson.Types.FromJSON.FromJSON Distribution.Types.PackageVersionConstraint.PackageVersionConstraint
+ Distribution.Nixpkgs.Haskell.OrphanInstances: instance Data.String.IsString Distribution.Types.PackageVersionConstraint.PackageVersionConstraint
- Distribution.Nixpkgs.Fetch: fetchWith :: (Bool, String, [String]) -> Source -> MaybeT IO (DerivationSource, FilePath)
+ Distribution.Nixpkgs.Fetch: fetchWith :: (Bool, String, Maybe String, [String]) -> Source -> MaybeT IO (DerivationSource, FilePath)
- Distribution.Nixpkgs.Haskell.Constraint: type Constraint = Dependency
+ Distribution.Nixpkgs.Haskell.Constraint: type Constraint = PackageVersionConstraint
- Distribution.Nixpkgs.Haskell.FromCabal: type HaskellResolver = Dependency -> Bool
+ Distribution.Nixpkgs.Haskell.FromCabal: type HaskellResolver = PackageVersionConstraint -> Bool
Files
- CHANGELOG.md +19/−0
- README.md +42/−11
- cabal2nix.cabal +7/−21
- hackage2nix/Main.hs +14/−10
- src/Distribution/Nixpkgs/Fetch.hs +11/−10
- src/Distribution/Nixpkgs/Haskell/Constraint.hs +7/−3
- src/Distribution/Nixpkgs/Haskell/FromCabal.hs +22/−5
- src/Distribution/Nixpkgs/Haskell/FromCabal/Configuration.hs +12/−1
- src/Distribution/Nixpkgs/Haskell/FromCabal/Name.hs +6/−2
- src/Distribution/Nixpkgs/Haskell/FromCabal/PostProcess.hs +6/−5
- src/Distribution/Nixpkgs/Haskell/OrphanInstances.hs +5/−4
- src/Distribution/Nixpkgs/Haskell/PackageSourceSpec.hs +2/−2
- test/golden-test-cases/hakyll.nix.golden +2/−2
+ CHANGELOG.md view
@@ -0,0 +1,19 @@+# Revision History for cabal2nix++## 2.18.0++* Support GHC 9.0.x and Cabal 3.4.0.0,+ **API breaking change**+ (See [#503](https://github.com/NixOS/cabal2nix/pull/503))+* Fix fetching remote _archives_: Previously they weren't properly+ unpacked, **API breaking change**+ (See [#455](https://github.com/NixOS/cabal2nix/pull/455))+* Resolution of system dependency attribute names in nixpkgs+ * Update changed upstream attribute names, reflect deprecations+ * Fix hackage2nix not resolving certain attribute names if multiple+ attribute names referred to the same derivation.+ (See [#492](https://github.com/NixOS/cabal2nix/pull/492) and+ [distribution-nixpkgs#10](https://github.com/NixOS/distribution-nixpkgs/pull/10))+* hackage2nix: accept multiple config files at the command+ line given by specifying `--config` more than once+ (See [#494](https://github.com/NixOS/cabal2nix/pull/494))
README.md view
@@ -68,16 +68,47 @@ ## Building -For ease of contribution, we support these methods to build `cabal2nix`:+`cabal2nix` is built using [`cabal-install`](https://www.haskell.org/cabal/),+like you'd expect, and you are free to use your favourite way of setting up+a Haskell development environment. -* `stack build` if you have [_Stack_](http://haskellstack.org/)- * The Stack build can use system dependencies from a pinned nixpkgs- version for increased reproducibility (see [`stack.yaml`](./stack.yaml)).- On NixOS this happens automatically.- On non-NixOS, use `stack --nix build` for that.-* `cabal install` if you have [_cabal-install_](https://www.haskell.org/cabal/)- installed-* TODO: Add a build method that requires only `nix` preinstalled,- also pins nixpkgs, and is thus fully reproducible.+Since `cabal2nix` is quite intertwined with the packages `distribution-nixpkgs`+and `hackage-db`, we recommend setting up a shared development environment+for the three packages like so: -When making changes, please ensure that all these methods continue to work.+```console+$ mkdir /path/to/cabal2nix-root && cd /path/to/cabal2nix-root+$ # clone repositories, note that you may need to checkout an+$ # older tag for some depending on breaking changes on master.+$ git clone https://github.com/NixOS/cabal2nix.git+$ git clone https://github.com/NixOS/hackage-db.git+$ git clone https://github.com/NixOS/distribution-nixpkgs.git+$ # setup development environment with shellFor+$ cat > shell.nix << EOF+# assumes nix{os,pkgs}-unstable+{ pkgs ? import <nixpkgs> {} }:++pkgs.haskellPackages.shellFor {+ packages = p: [+ p.cabal2nix-unstable+ p.distribution-nixpkgs+ p.hackage-db+ ];++ # for running doctests locally+ nativeBuildInputs = [+ pkgs.haskellPackages.doctest+ ];++ # set environment variable, so the development version of+ # distribution-nixpkgs finds derivation-attr-paths.nix+ distribution_nixpkgs_datadir = toString ./distribution-nixpkgs;+}+EOF+$ # tell cabal about local packages+$ cat > cabal.project << EOF+packages: ./*/*.cabal+EOF+$ # test our new development environment+$ nix-shell --run "cabal v2-build exe:cabal2nix exe:hackage2nix"+```
cabal2nix.cabal view
@@ -1,5 +1,5 @@ name: cabal2nix-version: 2.17.0+version: 2.18.0 synopsis: Convert Cabal files into Nix build instructions. description: Convert Cabal files into Nix build instructions. Users of Nix can install the latest@@ -8,31 +8,17 @@ > nix-env -i cabal2nix license: BSD3 license-file: LICENSE-author: Peter Simons, Andres Loeh, Benno Fünfstück, Mateusz Kowalczyk,- Michael Alan Dorman, Tom Smalley, Mathijs Kwik, Shea Levy, Dmitry- Malikov, Eric Seidel, Jacob Mitchell, Graham Christensen,- Hamish Mackenzie, Nikolay Amiantov, Aycan iRiCAN, Bryan- Gardiner, Joe Hermaszewski, John Wiegley, Philipp Hausmann,- Spencer Janssen, Tom Hunger, William Casarin, koral,- ksaric, Adam Vogt, Alexey Shmalko, Corey O'Connor, Cray- Elliott, David Johnson, Dmitry Bushev, Domen Kožar, Felix- Kunzmann, Gabriel Ebner, Gergely Risko, Joachim Fasting,- John Albietz, John Chee, Jussi Maki, Lisanna Dettwyler,- Mark Laws, Mark Wotton, Matthew Pickering, Matthew Stewart,- Matvey Aksenov, Nicholas Clarke, Nicolas Rolland, Oliver- Charles, Pascal Wittmann, Patrick John Wheeler, Phil de- Joux, Piotr Bogdan, Profpatsch, Raymond Gauthier, Renzo- Carbonara, Rodney Lorrimar, Sibi, Sukant Hajra, Tanner- Doshier, Vaibhav Sagar, Viktar Basharymau, danbst, karsten- gebbert, laMudri, Александр Цамутали-maintainer: Peter Simons <simons@cryp.to>+author: Peter Simons <simons@cryp.to>+-- list all contributors: git log --pretty='%an' | sort | uniq+maintainer: sternenseemann <sternenseemann@systemli.org> stability: stable-tested-with: GHC == 8.10.3+tested-with: GHC == 8.10.4 || == 9.0.1 category: Distribution, Nix homepage: https://github.com/nixos/cabal2nix#readme bug-reports: https://github.com/nixos/cabal2nix/issues build-type: Simple extra-source-files: README.md+ CHANGELOG.md test/golden-test-cases/*.cabal test/golden-test-cases/*.nix.golden cabal-version: 1.24@@ -114,7 +100,7 @@ , cabal2nix , containers , directory- , distribution-nixpkgs >= 1.2+ , distribution-nixpkgs >= 1.6 , filepath , hopenssl >= 2 , language-nix
hackage2nix/Main.hs view
@@ -29,6 +29,7 @@ import Distribution.Package import Distribution.PackageDescription hiding ( options, extraLibs, buildTools, homepage ) import Distribution.System+import Distribution.Types.PackageVersionConstraint import Distribution.Text import Distribution.Version import Language.Nix@@ -37,6 +38,9 @@ import System.FilePath import System.IO import Text.PrettyPrint.HughesPJClass hiding ( (<>) )+import Data.List.NonEmpty (NonEmpty)+import Data.Semigroup (sconcat)+import Options.Applicative.NonEmpty (some1) type PackageSet = Map PackageName Version type PackageMultiSet = Map PackageName (Set Version)@@ -45,7 +49,7 @@ { hackageRepository :: FilePath , preferredVersionsFile :: Maybe FilePath , nixpkgsRepository :: FilePath- , configFile :: FilePath+ , configFiles :: NonEmpty FilePath , targetPlatform :: Platform } deriving (Show)@@ -57,7 +61,7 @@ <$> strOption (long "hackage" <> help "path to Hackage git repository" <> value "hackage" <> showDefaultWith id <> metavar "PATH") <*> optional (strOption (long "preferred-versions" <> help "path to Hackage preferred-versions file" <> value "hackage/preferred-versions" <> showDefault <> metavar "PATH")) <*> strOption (long "nixpkgs" <> help "path to Nixpkgs repository" <> value "nixpkgs" <> showDefaultWith id <> metavar "PATH")- <*> strOption (long "config" <> help "path to configuration file inside of Nixpkgs" <> value "pkgs/development/haskell-modules/configuration-hackage2nix.yaml" <> showDefaultWith id <> metavar "PATH")+ <*> some1 (strOption (long "config" <> help "path to configuration file inside of Nixpkgs" <> metavar "PATH")) <*> option (fmap fromString str) (long "platform" <> help "target platform to generate package set for" <> value "x86_64-linux" <> showDefaultWith display <> metavar "PLATFORM") pinfo :: ParserInfo CLI@@ -71,8 +75,8 @@ ) CLI {..} <- execParser pinfo - config <- readConfiguration (nixpkgsRepository </> configFile)- nixpkgs <- readNixpkgPackageMap ["-f", nixpkgsRepository, "--arg", "config", "{ allowAliases = false; }"]+ config <- sconcat <$> mapM (\file -> readConfiguration (nixpkgsRepository </> file)) configFiles+ nixpkgs <- readNixpkgPackageMap nixpkgsRepository (Just "{ config = { allowAliases = false; }; }") preferredVersions <- readPreferredVersions (fromMaybe (hackageRepository </> "preferred-versions") preferredVersionsFile) let fixup = Map.delete "acme-everything" -- TODO: https://github.com/NixOS/cabal2nix/issues/164 . Map.delete "som" -- TODO: https://github.com/NixOS/cabal2nix/issues/164@@ -94,7 +98,7 @@ latestVersionSet = Map.map Set.findMax (Map.filter (not . Set.null) (Map.mapWithKey (enforcePreferredVersions preferredVersions) hackage)) defaultPackageOverridesSet :: PackageSet- defaultPackageOverridesSet = Map.fromList [ (name, resolveConstraint c hackage) | c@(Dependency name _ _) <- defaultPackageOverrides config ]+ defaultPackageOverridesSet = Map.fromList [ (name, resolveConstraint c hackage) | c@(PackageVersionConstraint name _) <- defaultPackageOverrides config ] generatedDefaultPackageSet :: PackageSet generatedDefaultPackageSet = (defaultPackageOverridesSet `Map.union` latestVersionSet) `Map.difference` corePackageSet@@ -107,7 +111,7 @@ extraPackageSet :: PackageMultiSet extraPackageSet = Map.unionsWith Set.union- [ Map.singleton name (Set.singleton (resolveConstraint c hackage)) | c@(Dependency name _ _) <- extraPackages config ]+ [ Map.singleton name (Set.singleton (resolveConstraint c hackage)) | c@(PackageVersionConstraint name _) <- extraPackages config ] db :: PackageMultiSet db = Map.unionsWith Set.union [ Map.map Set.singleton generatedDefaultPackageSet@@ -116,8 +120,8 @@ , extraPackageSet ] - haskellResolver :: Dependency -> Bool- haskellResolver (Dependency name vrange _)+ haskellResolver :: HaskellResolver+ haskellResolver (PackageVersionConstraint name vrange) | Just v <- Map.lookup name corePackageSet = v `withinRange` vrange | Just v <- Map.lookup name generatedDefaultPackageSet = v `withinRange` vrange | otherwise = False@@ -139,7 +143,7 @@ let isInDefaultPackageSet, isHydraEnabled, isBroken :: Bool isInDefaultPackageSet = (== Just v) (Map.lookup name generatedDefaultPackageSet) isHydraEnabled = isInDefaultPackageSet && not (isBroken || name `Set.member` dontDistributePackages config)- isBroken = any (withinRange v) [ vr | Dependency pn vr _ <- brokenPackages config, pn == name ]+ isBroken = any (withinRange v) [ vr | PackageVersionConstraint pn vr <- brokenPackages config, pn == name ] droppedPlatforms :: Set Platform droppedPlatforms = Map.findWithDefault mempty name (unsupportedPlatforms config)@@ -206,7 +210,7 @@ ] resolveConstraint' :: Constraint -> Hackage -> Maybe Version-resolveConstraint' (Dependency name vrange _) hackage+resolveConstraint' (PackageVersionConstraint name vrange) hackage | Just vset' <- Map.lookup name hackage , vset <- Set.filter (`withinRange` vrange) vset' , not (Set.null vset) = Just (Set.findMax vset)
src/Distribution/Nixpkgs/Fetch.hs view
@@ -108,11 +108,12 @@ fetch optSubModules f = runMaybeT . fetchers where fetchers :: Source -> MaybeT IO (DerivationSource, a) fetchers source = msum . (fetchLocal source :) $ map (\fetcher -> fetchWith fetcher source >>= process)- [ (False, "url", [])- , (True, "git", ["--fetch-submodules" | optSubModules ])- , (True, "hg", [])- , (True, "svn", [])- , (True, "bzr", [])+ [ (False, "url", Nothing, [])+ , (False, "zip", Just "nix-prefetch-url", ["--unpack"])+ , (True, "git", Nothing, ["--fetch-submodules" | optSubModules ])+ , (True, "hg", Nothing, [])+ , (True, "svn", Nothing, [])+ , (True, "bzr", Nothing, []) ] -- | Remove '/' from the end of the path. Nix doesn't accept paths that@@ -133,7 +134,7 @@ localArchive :: FilePath -> MaybeT IO (DerivationSource, a) localArchive path = do absolutePath <- liftIO $ canonicalizePath path- unpacked <- snd <$> fetchWith (False, "url", ["--unpack"]) (Source ("file://" ++ absolutePath) "" UnknownHash ".")+ unpacked <- snd <$> fetchWith (False, "url", Nothing, ["--unpack"]) (Source ("file://" ++ absolutePath) "" UnknownHash ".") process (localDerivationSource absolutePath, unpacked) process :: (DerivationSource, FilePath) -> MaybeT IO (DerivationSource, a)@@ -142,8 +143,8 @@ localDerivationSource p = DerivationSource "" p "" "" Nothing -- | Like 'fetch', but allows to specify which script to use.-fetchWith :: (Bool, String, [String]) -> Source -> MaybeT IO (DerivationSource, FilePath)-fetchWith (supportsRev, kind, addArgs) source = do+fetchWith :: (Bool, String, Maybe String, [String]) -> Source -> MaybeT IO (DerivationSource, FilePath)+fetchWith (supportsRev, kind, command, addArgs) source = do unless ((sourceRevision source /= "") || isUnknown (sourceHash source) || not supportsRev) $ liftIO (hPutStrLn stderr "** need a revision for VCS when the hash is given. skipping.") >> mzero @@ -173,14 +174,14 @@ , derivHash = BS.unpack (head ls) , derivSubmodule = Nothing }- , sourceUrl source))+ , BS.unpack l)) _ -> case eitherDecode buf' of Left err -> error ("invalid JSON: " ++ err ++ " in " ++ show buf') Right ds -> return (Just (ds { derivKind = kind }, BS.unpack l)) where script :: String- script = "nix-prefetch-" ++ kind+ script = fromMaybe ("nix-prefetch-" ++ kind) command args :: [String] args = addArgs ++ sourceUrl source : [ sourceRevision source | supportsRev ] ++ hashToList (sourceHash source)
src/Distribution/Nixpkgs/Haskell/Constraint.hs view
@@ -1,15 +1,19 @@ module Distribution.Nixpkgs.Haskell.Constraint- ( Constraint, satisfiesConstraint, satisfiesConstraints+ ( Constraint, constraintPkgName, satisfiesConstraint, satisfiesConstraints ) where import Distribution.Package import Distribution.Version+import Distribution.Types.PackageVersionConstraint import Distribution.Nixpkgs.Haskell.OrphanInstances ( ) -type Constraint = Dependency+type Constraint = PackageVersionConstraint +constraintPkgName :: Constraint -> PackageName+constraintPkgName (PackageVersionConstraint n _) = n+ satisfiesConstraint :: PackageIdentifier -> Constraint -> Bool-satisfiesConstraint (PackageIdentifier pn v) (Dependency cn vr _) = (pn /= cn) || (v `withinRange` vr)+satisfiesConstraint (PackageIdentifier pn v) (PackageVersionConstraint cn vr) = (pn /= cn) || (v `withinRange` vr) satisfiesConstraints :: PackageIdentifier -> [Constraint] -> Bool satisfiesConstraints p = all (satisfiesConstraint p)
src/Distribution/Nixpkgs/Haskell/FromCabal.hs view
@@ -26,6 +26,7 @@ import qualified Distribution.PackageDescription as Cabal import Distribution.PackageDescription.Configuration as Cabal import Distribution.System+import Distribution.Types.PackageVersionConstraint import Distribution.Text ( display ) import Distribution.Types.ComponentRequestedSpec as Cabal import Distribution.Types.ExeDependency as Cabal@@ -36,7 +37,7 @@ import Distribution.Version import Language.Nix -type HaskellResolver = Dependency -> Bool+type HaskellResolver = PackageVersionConstraint -> Bool type NixpkgsResolver = Identifier -> Maybe Binding fromGenericPackageDescription :: HaskellResolver -> NixpkgsResolver -> Platform -> CompilerInfo -> FlagAssignment -> [Constraint] -> GenericPackageDescription -> Derivation@@ -48,10 +49,26 @@ finalizeGenericPackageDescription :: HaskellResolver -> Platform -> CompilerInfo -> FlagAssignment -> [Constraint] -> GenericPackageDescription -> (PackageDescription, [Dependency]) finalizeGenericPackageDescription haskellResolver arch compiler flags constraints genDesc = let+ -- finalizePD incooperates the 'LibraryName' of a dependency+ -- which we always ignore, so the Cabal-compatible resolver+ -- is a simple wrapper around our 'HaskellResolver'+ makeCabalResolver :: HaskellResolver -> Dependency -> Bool+ makeCabalResolver r (Dependency n v _) = r (PackageVersionConstraint n v)++ -- the finalizePD API changed in Cabal 3.4.0.0, so we need to do some plumbing.+ -- See https://github.com/haskell/cabal/issues/5570+#if MIN_VERSION_Cabal(3,4,0)+ makeCabalConstraints :: [Constraint] -> [PackageVersionConstraint]+ makeCabalConstraints = id+#else+ makeCabalConstraints :: [Constraint] -> [Dependency]+ makeCabalConstraints = map $ \(PackageVersionConstraint n v) -> Dependency n v mempty+#endif+ -- We have to call the Cabal finalizer several times with different resolver -- functions, and this convenience function makes our code shorter. finalize :: HaskellResolver -> Either [Dependency] (PackageDescription,FlagAssignment)- finalize resolver = finalizePD flags requestedComponents resolver arch compiler constraints genDesc+ finalize resolver = finalizePD flags requestedComponents (makeCabalResolver resolver) arch compiler (makeCabalConstraints constraints) genDesc requestedComponents :: ComponentRequestedSpec requestedComponents = ComponentRequestedSpec@@ -60,10 +77,10 @@ } jailbroken :: HaskellResolver -> HaskellResolver- jailbroken resolver (Dependency pkg _ _) = resolver (Dependency pkg anyVersion mempty)+ jailbroken resolver (PackageVersionConstraint pkg _) = resolver (PackageVersionConstraint pkg anyVersion) withInternalLibs :: HaskellResolver -> HaskellResolver- withInternalLibs resolver d = depPkgName d `elem` internalNames || resolver d+ withInternalLibs resolver c = constraintPkgName c `elem` internalNames || resolver c internalNames :: [PackageName] internalNames = [ unqualComponentNameToPackageName n | (n,_) <- condSubLibraries genDesc ]@@ -152,7 +169,7 @@ | otherwise = bindNull i resolveInHackageThenNixpkgs :: Identifier -> Binding- resolveInHackageThenNixpkgs i | haskellResolver (Dependency (mkPackageName (i^.ident)) anyVersion mempty) = resolveInHackage i+ resolveInHackageThenNixpkgs i | haskellResolver (PackageVersionConstraint (mkPackageName (i^.ident)) anyVersion) = resolveInHackage i | otherwise = resolveInNixpkgs i internalLibNames :: [PackageName]
src/Distribution/Nixpkgs/Haskell/FromCabal/Configuration.hs view
@@ -66,6 +66,17 @@ instance NFData Configuration +instance Semigroup Configuration where+ l <> r = Configuration { compilerInfo = compilerInfo l+ , corePackages = corePackages l <> corePackages r+ , defaultPackageOverrides = defaultPackageOverrides l <> defaultPackageOverrides r+ , extraPackages = extraPackages l <> extraPackages r+ , packageMaintainers = packageMaintainers l <> packageMaintainers r+ , unsupportedPlatforms = unsupportedPlatforms l <> unsupportedPlatforms r+ , dontDistributePackages = dontDistributePackages l <> dontDistributePackages r+ , brokenPackages = brokenPackages l <> brokenPackages r+ }+ instance FromJSON Configuration where parseJSON (Object o) = Configuration <$> o .:? "compiler" .!= unknownCompilerInfo buildCompilerId NoAbiTag@@ -98,7 +109,7 @@ assertConsistency cfg@Configuration {..} = do let report msg = fail ("*** configuration error: " ++ msg) maintainedPackages = Set.unions (Map.elems packageMaintainers)- disabledPackages = dontDistributePackages `Set.union` Set.fromList (depPkgName <$> brokenPackages)+ disabledPackages = dontDistributePackages `Set.union` Set.fromList (constraintPkgName <$> brokenPackages) disabledMaintainedPackages = maintainedPackages `Set.intersection` disabledPackages unless (Set.null disabledMaintainedPackages) $ report ("disabled packages that have a maintainer: " ++ show disabledMaintainedPackages)
src/Distribution/Nixpkgs/Haskell/FromCabal/Name.hs view
@@ -23,11 +23,11 @@ libNixName :: String -> [Identifier] libNixName "" = [] libNixName "adns" = return "adns"-libNixName "alsa" = return "alsaLib"+libNixName "alsa" = return "alsa-lib" libNixName "alut" = return "freealut" libNixName "appindicator-0.1" = return "libappindicator-gtk2" libNixName "appindicator3-0.1" = return "libappindicator-gtk3"-libNixName "asound" = return "alsaLib"+libNixName "asound" = return "alsa-lib" libNixName "b2" = return "libb2" libNixName "boost_context" = return "boost" libNixName "bz2" = return "bzip2"@@ -111,11 +111,13 @@ libNixName "libzip" = return "libzip" libNixName "libzmq" = return "zeromq" libNixName "liquid" = return "liquid-dsp"+libNixName "lzma" = return "xz" libNixName "m" = [] -- in stdenv libNixName "magic" = return "file" libNixName "MagickWand" = return "imagemagick" libNixName "mnl" = return "libmnl" libNixName "mpi" = return "openmpi"+libNixName "mysql" = return "mariadb" libNixName "ncursesw" = return "ncurses" libNixName "netsnmp" = return "net_snmp" libNixName "nix-expr" = return "nix"@@ -187,6 +189,7 @@ libNixName "Xpm" = return "libXpm" libNixName "Xrandr" = return "libXrandr" libNixName "Xrender" = return "libXrender"+libNixName "xscrnsaver" = return "libXScrnSaver" libNixName "Xss" = return "libXScrnSaver" libNixName "Xtst" = return "libXtst" libNixName "Xxf86vm" = return "libXxf86vm"@@ -211,6 +214,7 @@ buildToolNixName "nix-hash" = return "nix" buildToolNixName "nix-instantiate" = return "nix" buildToolNixName "nix-store" = return "nix"+buildToolNixName "utillinux" = return "util-linux" buildToolNixName x = return (fromString x) -- | Helper function to extract the package name from a String that may or may
src/Distribution/Nixpkgs/Haskell/FromCabal/PostProcess.hs view
@@ -16,13 +16,14 @@ import Distribution.Nixpkgs.License import Distribution.Package import Distribution.System+import Distribution.Types.PackageVersionConstraint import Distribution.Text import Distribution.Version import Language.Nix postProcess :: Derivation -> Derivation postProcess deriv =- foldr (.) id [ f | (Dependency n vr _, f) <- hooks, packageName deriv == n, packageVersion deriv `withinRange` vr ]+ foldr (.) id [ f | (PackageVersionConstraint n vr, f) <- hooks, packageName deriv == n, packageVersion deriv `withinRange` vr ] . fixGtkBuilds . fixBuildDependsForTools $ deriv@@ -70,7 +71,7 @@ ] ] -hooks :: [(Dependency, Derivation -> Derivation)]+hooks :: [(PackageVersionConstraint, Derivation -> Derivation)] hooks = [ ("Agda < 2.5", set (executableDepends . tool . contains (pkg "emacs")) True . set phaseOverrides agdaPostInstall) , ("Agda >= 2.5 && < 2.6", set (executableDepends . tool . contains (pkg "emacs")) True . set phaseOverrides agda25PostInstall)@@ -120,7 +121,7 @@ , ("gtk3", gtk3Hook) , ("gtkglext", gtkglextHook) , ("haddock", haddockHook) -- https://github.com/haskell/haddock/issues/511- , ("hakyll", set (testDepends . tool . contains (pkg "utillinux")) True) -- test suite depends on "rev"+ , ("hakyll", set (testDepends . tool . contains (pkg "util-linux")) True) -- test suite depends on "rev" , ("haskell-src-exts", set doCheck False) , ("hfsevents", hfseventsOverrides) , ("HFuse", set phaseOverrides hfusePreConfigure)@@ -141,12 +142,12 @@ , ("js-jquery", set doCheck False) -- attempts to access the network , ("libconfig", over (libraryDepends . system) (replace "config = null" (pkg "libconfig"))) , ("libxml", set (configureFlags . contains "--extra-include-dir=${libxml2.dev}/include/libxml2") True)- , ("liquid-fixpoint", set (executableDepends . system . contains (pkg "ocaml")) True . set (testDepends . system . contains (pkg "z3")) True . set (testDepends . system . contains (pkg "nettools")) True . set (testDepends . system . contains (pkg "git")) True . set doCheck False)+ , ("liquid-fixpoint", set (testDepends . system . contains (pkg "z3")) True . set (testDepends . system . contains (pkg "nettools")) True . set (testDepends . system . contains (pkg "git")) True . set doCheck False) , ("liquidhaskell", set (testDepends . system . contains (pkg "z3")) True) , ("lzma-clib", over (metaSection . platforms) (Set.filter (\(Platform _ os) -> os == Windows)) . set (libraryDepends . haskell . contains (self "only-buildable-on-windows")) False) , ("MFlow < 4.6", set (libraryDepends . tool . contains (self "cpphs")) True) , ("mwc-random", set doCheck False)- , ("mysql", set (libraryDepends . system . contains (pkg "mysql")) True)+ , ("mysql", set (libraryDepends . system . contains (pkg "libmysqlclient")) True) , ("network-attoparsec", set doCheck False) -- test suite requires network access , ("numeric-qq", set doCheck False) -- test suite doesn't finish even after 1+ days , ("opencv", opencvOverrides)
src/Distribution/Nixpkgs/Haskell/OrphanInstances.hs view
@@ -11,6 +11,7 @@ import Distribution.Package import Distribution.Parsec import Distribution.System+import Distribution.Types.PackageVersionConstraint import Distribution.Pretty as Cabal import qualified Data.Version as Base import Distribution.Version@@ -28,8 +29,8 @@ instance IsString PackageIdentifier where fromString = text2isString "PackageIdentifier" -instance IsString Dependency where- fromString = text2isString "Dependency"+instance IsString PackageVersionConstraint where+ fromString = text2isString "PackageVersionConstraint" instance IsString CompilerId where fromString = text2isString "CompilerId"@@ -58,9 +59,9 @@ parseJSON (String s) = return (fromString (T.unpack s)) parseJSON s = fail ("parseJSON: " ++ show s ++ " is not a valid Cabal VersionRange") -instance FromJSON Dependency where+instance FromJSON PackageVersionConstraint where parseJSON (String s) = return (fromString (T.unpack s))- parseJSON s = fail ("parseJSON: " ++ show s ++ " is not a valid Haskell Dependency")+ parseJSON s = fail ("parseJSON: " ++ show s ++ " is not a valid Haskell PackageVersionConstraint") instance FromJSON CompilerInfo where parseJSON (String s) = return (unknownCompilerInfo (fromString (T.unpack s)) NoAbiTag)
src/Distribution/Nixpkgs/Haskell/PackageSourceSpec.hs view
@@ -160,7 +160,7 @@ seq (length hash) $ urlDerivationSource url hash <$ writeFile cacheFile hash UnknownHash -> do- maybeHash <- runMaybeT (derivHash . fst <$> fetchWith (False, "url", []) (Source url "" UnknownHash cabalDir))+ maybeHash <- runMaybeT (derivHash . fst <$> fetchWith (False, "url", Nothing, []) (Source url "" UnknownHash cabalDir)) case maybeHash of Just hash -> seq (length hash) $@@ -208,7 +208,7 @@ onlyCabalFromDirectory dir errMsg = do cabals <- liftIO $ getDirectoryContents dir >>= filterM doesFileExist . map (dir </>) . filter (".cabal" `isSuffixOf`) case cabals of- [] -> fail errMsg+ [] -> liftIO $ fail errMsg [cabalFile] -> (,) False <$> cabalFromFile True cabalFile _ -> liftIO $ fail ("*** found more than one cabal file (" ++ show cabals ++ "). Exiting.")
test/golden-test-cases/hakyll.nix.golden view
@@ -5,7 +5,7 @@ , pandoc-citeproc, parsec, process, QuickCheck, random, regex-base , regex-tdfa, resourcet, scientific, system-filepath, tagsoup , tasty, tasty-hunit, tasty-quickcheck, text, time-, time-locale-compat, unordered-containers, utillinux, vector, wai+, time-locale-compat, unordered-containers, util-linux, vector, wai , wai-app-static, warp, yaml }: mkDerivation {@@ -35,7 +35,7 @@ time time-locale-compat unordered-containers vector wai wai-app-static warp yaml ];- testToolDepends = [ utillinux ];+ testToolDepends = [ util-linux ]; homepage = "http://jaspervdj.be/hakyll"; description = "A static website compiler library"; license = lib.licenses.bsd3;