git.iko.soy/typeable/cabal2nix
on master help sign in
Remove cartel cruft.
d89134fPeter Simons
.ghcideleted−5
@@ -1,5 +0,0 @@
1−-- generate-cabal-file.hs needs the cartel library, but the Cabal file
2−-- doesn't mention that library anywhere, so we need to add it manually
3−-- to make haskell-mode's interactive-mode feature happy.
4−
5−:set -package cartel
.gitignore−3
@@ -3,10 +3,7 @@
3/Setup
3/Setup
4/Setup.hi
4/Setup.hi
5/Setup.o
5/Setup.o
6−/cabal2nix.cabal
7/dist/*
6/dist/*
8−/src/Internal/Version.hs
9−/test/doctest.hs
10
7
11# vim tmp files
8# vim tmp files
12
9
.travis.yml+6−10
@@ -1,8 +1,5 @@
1# .travis.yml
1# .travis.yml
2
2
3−git:
4− depth: 50000
5−
6env:
3env:
7 - CABALVER=1.22 GHCVER=7.10.2
4 - CABALVER=1.22 GHCVER=7.10.2
8
5
@@ -16,15 +13,14 @@ install:
16 - cabal --version
13 - cabal --version
17 - echo "$(ghc --version) [$(ghc --print-project-git-commit-id 2> /dev/null || echo '?')]"
14 - echo "$(ghc --version) [$(ghc --print-project-git-commit-id 2> /dev/null || echo '?')]"
18 - travis_retry cabal update
15 - travis_retry cabal update
19− - cabal sandbox init
20− - cabal install -j cartel mtl
21− - cabal exec runhaskell generate-cabal-file.hs >cabal2nix.cabal
22− - cabal sandbox delete
23 - cabal install -j --only-dependencies --enable-tests
16 - cabal install -j --only-dependencies --enable-tests
24
17
25script:
18script:
26− - cabal configure -v --enable-tests --ghc-option=-Wall --ghc-option=-Werror
27− - cabal build -j
28− - cabal test -j
29 - cabal check
19 - cabal check
20+ - cabal configure
30 - cabal sdist
21 - cabal sdist
22+ - tar xf dist/cabal2nix-*.tar.gz
23+ - cd cabal2nix-*
24+ - cabal configure -v --enable-tests --ghc-option=-Wall --ghc-option=-Werror --ghc-option=-j
25+ - cabal build -j
26+ - cabal test -j
GNUmakefile+14−12
@@ -1,31 +1,33 @@
1# GNUmakefile
1# GNUmakefile
2
2
3−.PHONY: all configure re-configure build check haddock hlint clean
3+.PHONY: all configure build check haddock hlint clean packunused
4
4
5all:: check
5all:: check
6
6
7configure:: cabal2nix.cabal
7configure:: cabal2nix.cabal
8 @cabal -v0 configure --ghc-option=-j --enable-tests
8 @cabal -v0 configure --ghc-option=-j --enable-tests
9
9
10−re-configure::
11− @rm -f cabal2nix.cabal
12− @$(MAKE) configure
13−
14build:: configure
10build:: configure
15 @cabal build -j
11 @cabal build -j
16
12
17−haddock:: build
18− @cabal haddock --hyperlink-source
19−
20check:: haddock
13check:: haddock
21 @cabal test -j
14 @cabal test -j
22
15
16+haddock:: build
17+ @cabal haddock --hyperlink-source
18+
23hlint::
19hlint::
24 hlint src
20 hlint src
25
21
22+packunused::
23+ @cabal clean
24+ @find . -name "*.imports" -exec rm {} +
25+ @cabal configure -O0 --disable-library-profiling
26+ @cabal build --ghc-option=-ddump-minimal-imports
27+ @packunused
28+
26clean::
29clean::
27− @rm -rf cabal2nix.cabal dist src/Internal/Version.hs test/doctest.hs TAGS
30+ @rm -rf dist TAGS
28
31
29−cabal2nix.cabal: generate-cabal-file.hs
32+cabal2nix.cabal : package.yaml
30− runhaskell "$<" >"$@"
33+ @hpack >/dev/null
31− @cabal check
cabal2nix.cabalnew file+191
@@ -0,0 +1,191 @@
1+-- This file has been generated from package.yaml by hpack version 0.5.4.
2+--
3+-- see: https://github.com/sol/hpack
4+
5+name: cabal2nix
6+version: 2015.8.29
7+description: Convert Cabal files into Nix build instructions.
8+category: Distribution
9+homepage: https://github.com/nixos/cabal2nix#readme
10+bug-reports: https://github.com/nixos/cabal2nix/issues
11+cabal-version: >= 1.10
12+license: BSD3
13+license-file: LICENSE
14+build-type: Simple
15+maintainer: Peter Simons <simons@cryp.to>
16+synopsis: Convert Cabal files into Nix build instructions.
17+
18+source-repository head
19+ type: git
20+ location: https://github.com/nixos/cabal2nix
21+
22+library
23+ hs-source-dirs:
24+ src
25+ ghc-options: -Wall
26+ build-depends:
27+ base < 5
28+ , Cabal >= 1.22.2
29+ , SHA
30+ , aeson
31+ , ansi-wl-pprint
32+ , base < 5
33+ , bytestring
34+ , containers
35+ , data-default
36+ , deepseq
37+ , deepseq-generics
38+ , directory
39+ , doctest
40+ , filepath
41+ , hackage-db
42+ , hspec
43+ , lens
44+ , monad-par
45+ , monad-par-extras
46+ , mtl
47+ , optparse-applicative
48+ , pretty >= 1.1.2
49+ , process
50+ , regex-posix
51+ , split
52+ , transformers
53+ , utf8-string
54+ exposed-modules:
55+ Distribution.Nixpkgs.Fetch
56+ Distribution.Nixpkgs.Haskell
57+ Distribution.Nixpkgs.Haskell.BuildInfo
58+ Distribution.Nixpkgs.Haskell.Constraint
59+ Distribution.Nixpkgs.Haskell.Derivation
60+ Distribution.Nixpkgs.Haskell.FromCabal
61+ Distribution.Nixpkgs.Haskell.FromCabal.Configuration
62+ Distribution.Nixpkgs.Haskell.FromCabal.Configuration.GHC7102
63+ Distribution.Nixpkgs.Haskell.FromCabal.Configuration.Maintainers
64+ Distribution.Nixpkgs.Haskell.FromCabal.Flags
65+ Distribution.Nixpkgs.Haskell.FromCabal.License
66+ Distribution.Nixpkgs.Haskell.FromCabal.Name
67+ Distribution.Nixpkgs.Haskell.FromCabal.Normalize
68+ Distribution.Nixpkgs.Haskell.FromCabal.PostProcess
69+ Distribution.Nixpkgs.Haskell.Hackage
70+ Distribution.Nixpkgs.Haskell.HackageGit
71+ Distribution.Nixpkgs.Haskell.OrphanInstances
72+ Distribution.Nixpkgs.License
73+ Distribution.Nixpkgs.Meta
74+ Distribution.Nixpkgs.PackageMap
75+ Internal.HaskellPackage
76+ Internal.Lens
77+ Internal.PrettyPrinting
78+ Language.Nix
79+ Language.Nix.Binding
80+ Language.Nix.Identifier
81+ Language.Nix.Path
82+ default-language: Haskell2010
83+
84+executable hackage2nix
85+ main-is: Main.hs
86+ hs-source-dirs:
87+ hackage2nix
88+ ghc-options: -Wall -threaded -rtsopts -with-rtsopts=-N
89+ build-depends:
90+ base < 5
91+ , Cabal >= 1.22.2
92+ , SHA
93+ , aeson
94+ , ansi-wl-pprint
95+ , base < 5
96+ , bytestring
97+ , containers
98+ , data-default
99+ , deepseq
100+ , deepseq-generics
101+ , directory
102+ , doctest
103+ , filepath
104+ , hackage-db
105+ , hspec
106+ , lens
107+ , monad-par
108+ , monad-par-extras
109+ , mtl
110+ , optparse-applicative
111+ , pretty >= 1.1.2
112+ , process
113+ , regex-posix
114+ , split
115+ , transformers
116+ , utf8-string
117+ , cabal2nix
118+ default-language: Haskell2010
119+
120+executable cabal2nix
121+ main-is: Main.hs
122+ hs-source-dirs:
123+ cabal2nix
124+ ghc-options: -Wall
125+ build-depends:
126+ base < 5
127+ , Cabal >= 1.22.2
128+ , SHA
129+ , aeson
130+ , ansi-wl-pprint
131+ , base < 5
132+ , bytestring
133+ , containers
134+ , data-default
135+ , deepseq
136+ , deepseq-generics
137+ , directory
138+ , doctest
139+ , filepath
140+ , hackage-db
141+ , hspec
142+ , lens
143+ , monad-par
144+ , monad-par-extras
145+ , mtl
146+ , optparse-applicative
147+ , pretty >= 1.1.2
148+ , process
149+ , regex-posix
150+ , split
151+ , transformers
152+ , utf8-string
153+ , cabal2nix
154+ default-language: Haskell2010
155+
156+test-suite spec
157+ type: exitcode-stdio-1.0
158+ main-is: Main.hs
159+ hs-source-dirs:
160+ test
161+ ghc-options: -Wall
162+ build-depends:
163+ base < 5
164+ , Cabal >= 1.22.2
165+ , SHA
166+ , aeson
167+ , ansi-wl-pprint
168+ , base < 5
169+ , bytestring
170+ , containers
171+ , data-default
172+ , deepseq
173+ , deepseq-generics
174+ , directory
175+ , doctest
176+ , filepath
177+ , hackage-db
178+ , hspec
179+ , lens
180+ , monad-par
181+ , monad-par-extras
182+ , mtl
183+ , optparse-applicative
184+ , pretty >= 1.1.2
185+ , process
186+ , regex-posix
187+ , split
188+ , transformers
189+ , utf8-string
190+ , cabal2nix
191+ default-language: Haskell2010
src/cabal2nix.hs → cabal2nix/Main.hsrenamed+3−2
@@ -13,9 +13,10 @@ import Distribution.Nixpkgs.Haskell.FromCabal.Configuration.GHC7102
13import Distribution.Nixpkgs.Meta
13import Distribution.Nixpkgs.Meta
14import Distribution.PackageDescription ( FlagName(..), FlagAssignment )
14import Distribution.PackageDescription ( FlagName(..), FlagAssignment )
15import Distribution.Simple.Utils ( lowercase )
15import Distribution.Simple.Utils ( lowercase )
16+import Distribution.Text ( display )
16import Internal.HaskellPackage
17import Internal.HaskellPackage
17import Internal.Lens
18import Internal.Lens
18−import Internal.Version
19+import Paths_cabal2nix
19import Internal.PrettyPrinting hiding ( (<>) )
20import Internal.PrettyPrinting hiding ( (<>) )
20import Language.Nix
21import Language.Nix
21import Options.Applicative
22import Options.Applicative
@@ -63,7 +64,7 @@ options = Options
63pinfo :: ParserInfo Options
64pinfo :: ParserInfo Options
64pinfo = info
65pinfo = info
65 ( helper
66 ( helper
66− <*> infoOption ("cabal2nix " ++ version) (long "version" <> help "Show version number")
67+ <*> infoOption ("cabal2nix " ++ display version) (long "version" <> help "Show version number")
67 <*> options
68 <*> options
68 )
69 )
69 ( fullDesc
70 ( fullDesc
generate-cabal-file.hsdeleted−139
@@ -1,139 +0,0 @@
1−module Main ( main ) where
2−
3−import Cartel
4−import Control.Monad.Trans ( liftIO )
5−import System.Process ( readProcess )
6−import Data.List ( intercalate )
7−import System.Environment ( getArgs )
8−
9−getVersion :: IO Version
10−getVersion = do
11− v <- readProcess "git" ["log", "-1", "--format=%ci"] ""
12− let [y4,y3,y2,y1,'-',m2,m1,'-',d2,d1] = head (words v)
13− return (read ('[':y4:y3:y2:y1:m2:m1:d2:d1:"]"))
14−
15−getGitVersion :: IO String
16−getGitVersion = do
17− [v] <- fmap lines (readProcess "git" ["describe", "--dirty"] "")
18− return v
19−
20−getAuthors :: IO [NonEmptyString]
21−getAuthors = do
22− buf <- readProcess "sh" ["-c", "git log --pretty=short | git shortlog --numbered --summary"] ""
23− return [ unwords (tail (words l)) | l <- lines buf, not (null l) ]
24−
25−properties :: Betsy IO Properties
26−properties = do
27− v <- liftIO getVersion
28− as <- liftIO getAuthors
29− return $ blank
30− { name = "cabal2nix"
31− , version = v
32− , buildType = Just simple
33− , category = "Distribution"
34− , maintainer = "Peter Simons <simons@cryp.to>"
35− , synopsis = "Convert Cabal files into Nix build instructions."
36− , description = [ "Convert Cabal files into Nix build instructions." ]
37− , license = Just bsd3
38− , licenseFile = "LICENSE"
39− , copyright = "Copyright (c) 2011-2015 by Peter Simons et al"
40− , author = intercalate ", " as
41− , stability = "Experimental"
42− , cabalVersion = Just (1,10)
43− , homepage = "http://github.com/NixOS/cabal2nix/"
44− , bugReports = "http://github.com/NixOS/cabal2nix/issues"
45− , extraSourceFiles = ["README.md"]
46− , testedWith = [(ghc, eq [7,10,2])]
47− }
48−
49−commonBuildOptions :: HasBuildInfo a => [a]
50−commonBuildOptions = hsSourceDirs ["src"] : haskell2010 : commonOptions
51−
52−commonOptions :: HasBuildInfo a => [a]
53−commonOptions = commonGhcOptions : commonBuildDepends
54−
55−commonGhcOptions :: HasBuildInfo a => a
56−commonGhcOptions = ghcOptions ["-Wall"]
57−
58−commonBuildDepends :: HasBuildInfo a => [a]
59−commonBuildDepends =
60− [ buildDepends
61− [ package "base" (lt [5])
62− , unconstrained "aeson"
63− , unconstrained "ansi-wl-pprint"
64− , unconstrained "bytestring"
65− , package "Cabal" (gtEq [1,22,2])
66− , unconstrained "containers"
67− , unconstrained "data-default"
68− , unconstrained "deepseq-generics"
69− , unconstrained "directory"
70− , unconstrained "filepath"
71− , unconstrained "hackage-db"
72− , unconstrained "lens"
73− , unconstrained "monad-par"
74− , unconstrained "monad-par-extras"
75− , unconstrained "mtl"
76− , unconstrained "optparse-applicative"
77− , package "pretty" (gtEq [1,1,2])
78− , unconstrained "process"
79− , unconstrained "pretty-show"
80− , unconstrained "regex-posix"
81− , unconstrained "SHA"
82− , unconstrained "split"
83− , unconstrained "transformers"
84− , unconstrained "utf8-string"
85− ]
86− ]
87−
88−commonTestOptions :: HasBuildInfo a => [a]
89−commonTestOptions = buildDepends
90− [ unconstrained "deepseq"
91− , unconstrained "doctest"
92− , unconstrained "hspec"
93− , unconstrained "QuickCheck"
94− ] : commonBuildOptions
95−
96−mkExecutable :: NonEmptyString -> [ExecutableField] -> Section
97−mkExecutable exe opt = executable exe $ mainIs (exe++".hs") : opt ++ commonBuildOptions
98−
99−mkTest :: NonEmptyString -> [TestSuiteField] -> Section
100−mkTest test opt = testSuite test $ exitcodeFields (test++".hs") ++ opt ++ hsSourceDirs ["test"] : commonTestOptions
101−
102−main :: IO ()
103−main = do
104− args <- getArgs
105− let releaseMode = "--release" `elem` args
106− defaultMainWithHeader (const (return "")) $ do
107− liftIO $ do ('v':gv) <- getGitVersion
108− writeFile "src/Internal/Version.hs" $
109− "module Internal.Version where\n\
110− \version :: String\n\
111− \version = " ++ show gv ++ "\n"
112− libraryModules <- modules "src"
113− liftIO $ writeFile "test/doctest.hs" (mkDoctest libraryModules)
114− props <- properties
115− return ( props
116− , exposedModules libraryModules : commonBuildOptions
117− , [ githubHead "NixOS" "cabal2nix"
118− , mkExecutable "cabal2nix" []
119− , mkExecutable "hackage2nix" [ buildable (not releaseMode)
120− , ghcOptions ["-threaded", "-rtsopts", "-with-rtsopts=-N"]
121− ]
122− , mkTest "spec" []
123− , mkTest "doctest" []
124− ]
125− )
126−
127−mkDoctest :: [NonEmptyString] -> String
128−mkDoctest libraryModules =
129− let paths = [ "src/" ++ map toPath l ++ ".hs" | l <- libraryModules ]
130− toPath '.' = '/'
131− toPath c = c
132− in
133− "module Main ( main ) where\n\
134− \import Test.DocTest\n\
135− \main :: IO ()\n\
136− \main = do\n\
137− \ doctest $ [\"-isrc\", \"-optP-include\", \"-optPdist/build/autogen/cabal_macros.h\"] ++ " ++ show paths ++ "\n\
138− \ doctest [\"-isrc\", \"-optP-include\", \"-optPdist/build/autogen/cabal_macros.h\", \"src/cabal2nix.hs\"]\n\
139− \ doctest [\"-isrc\", \"-optP-include\", \"-optPdist/build/autogen/cabal_macros.h\", \"src/hackage2nix.hs\"]\n"
src/hackage2nix.hs → hackage2nix/Main.hsrenamed+2−2
@@ -31,7 +31,7 @@ import Distribution.Package
31import Distribution.Version
31import Distribution.Version
32import Internal.Lens
32import Internal.Lens
33import Internal.PrettyPrinting hiding ( attr, (<>) )
33import Internal.PrettyPrinting hiding ( attr, (<>) )
34−import Internal.Version
34+import Paths_cabal2nix
35import Language.Nix
35import Language.Nix
36import Options.Applicative
36import Options.Applicative
37import System.FilePath
37import System.FilePath
@@ -67,7 +67,7 @@ options = Options
67pinfo :: ParserInfo Options
67pinfo :: ParserInfo Options
68pinfo = info
68pinfo = info
69 ( helper
69 ( helper
70− <*> infoOption ("hackage2nix " ++ version) (long "version" <> help "Show version number")
70+ <*> infoOption ("hackage2nix " ++ display version) (long "version" <> help "Show version number")
71 <*> options
71 <*> options
72 )
72 )
73 ( fullDesc
73 ( fullDesc
package.yamlnew file+91
@@ -0,0 +1,91 @@
1+name: cabal2nix
2+version: 2015.8.29
3+synopsis: Convert Cabal files into Nix build instructions.
4+description: Convert Cabal files into Nix build instructions.
5+maintainer: Peter Simons <simons@cryp.to>
6+license: BSD3
7+github: nixos/cabal2nix
8+category: Distribution
9+
10+ghc-options: -Wall
11+
12+dependencies:
13+ - base < 5
14+ - Cabal >= 1.22.2
15+ - SHA
16+ - aeson
17+ - ansi-wl-pprint
18+ - base < 5
19+ - bytestring
20+ - containers
21+ - data-default
22+ - deepseq
23+ - deepseq-generics
24+ - directory
25+ - doctest
26+ - filepath
27+ - hackage-db
28+ - hspec
29+ - lens
30+ - monad-par
31+ - monad-par-extras
32+ - mtl
33+ - optparse-applicative
34+ - pretty >= 1.1.2
35+ - process
36+ - regex-posix
37+ - split
38+ - transformers
39+ - utf8-string
40+
41+library:
42+ source-dirs: src
43+ exposed-modules:
44+ - Distribution.Nixpkgs.Fetch
45+ - Distribution.Nixpkgs.Haskell
46+ - Distribution.Nixpkgs.Haskell.BuildInfo
47+ - Distribution.Nixpkgs.Haskell.Constraint
48+ - Distribution.Nixpkgs.Haskell.Derivation
49+ - Distribution.Nixpkgs.Haskell.FromCabal
50+ - Distribution.Nixpkgs.Haskell.FromCabal.Configuration
51+ - Distribution.Nixpkgs.Haskell.FromCabal.Configuration.GHC7102
52+ - Distribution.Nixpkgs.Haskell.FromCabal.Configuration.Maintainers
53+ - Distribution.Nixpkgs.Haskell.FromCabal.Flags
54+ - Distribution.Nixpkgs.Haskell.FromCabal.License
55+ - Distribution.Nixpkgs.Haskell.FromCabal.Name
56+ - Distribution.Nixpkgs.Haskell.FromCabal.Normalize
57+ - Distribution.Nixpkgs.Haskell.FromCabal.PostProcess
58+ - Distribution.Nixpkgs.Haskell.Hackage
59+ - Distribution.Nixpkgs.Haskell.HackageGit
60+ - Distribution.Nixpkgs.Haskell.OrphanInstances
61+ - Distribution.Nixpkgs.License
62+ - Distribution.Nixpkgs.Meta
63+ - Distribution.Nixpkgs.PackageMap
64+ - Internal.HaskellPackage
65+ - Internal.Lens
66+ - Internal.PrettyPrinting
67+ - Language.Nix
68+ - Language.Nix.Binding
69+ - Language.Nix.Identifier
70+ - Language.Nix.Path
71+
72+executables:
73+ cabal2nix:
74+ main: Main.hs
75+ source-dirs: cabal2nix
76+ dependencies: cabal2nix
77+
78+ hackage2nix:
79+ main: Main.hs
80+ source-dirs: hackage2nix
81+ dependencies: cabal2nix
82+ ghc-options:
83+ - -threaded
84+ - -rtsopts
85+ - -with-rtsopts=-N
86+
87+tests:
88+ spec:
89+ main: Main.hs
90+ source-dirs: test
91+ dependencies: cabal2nix
release.nix+19−15
@@ -13,29 +13,33 @@ in
13 cabal2nix = genAttrs supportedCompilers (ghcVer: genAttrs supportedPlatforms (system:
13 cabal2nix = genAttrs supportedCompilers (ghcVer: genAttrs supportedPlatforms (system:
14 let
14 let
15 pkgs = import <nixpkgs> { inherit system; };
15 pkgs = import <nixpkgs> { inherit system; };
16− haskellPackages = pkgs.lib.getAttrFromPath ["haskell-ng" "packages" ghcVer] pkgs;
16+ haskellPackages = pkgs.lib.getAttrFromPath ["haskell" "packages" ghcVer] pkgs;
17 in
17 in
18 haskellPackages.mkDerivation {
18 haskellPackages.mkDerivation {
19 pname = "cabal2nix";
19 pname = "cabal2nix";
20 version = cabal2nixSrc.gitTag;
20 version = cabal2nixSrc.gitTag;
21 src = cabal2nixSrc;
21 src = cabal2nixSrc;
22− isLibrary = false;
22+ isLibrary = true;
23 isExecutable = true;
23 isExecutable = true;
24− preConfigure = "runhaskell $setupCompileFlags generate-cabal-file.hs >cabal2nix.cabal";
25− buildTools = with haskellPackages; [ cartel pkgs.git ];
26− buildDepends = with haskellPackages; [
24+ libraryHaskellDepends = with haskellPackages; [
27− aeson base bytestring Cabal containers deepseq deepseq-generics
25+ aeson ansi-wl-pprint base bytestring Cabal containers data-default
28− directory filepath hackage-db monad-par monad-par-extras mtl pretty
26+ deepseq deepseq-generics directory doctest filepath hackage-db
27+ hspec lens monad-par monad-par-extras mtl optparse-applicative
29− process QuickCheck regex-posix SHA split transformers
28+ pretty process regex-posix SHA split transformers utf8-string
30− utf8-string lens optparse-applicative data-default pretty-show
31 ];
29 ];
32− testDepends = with haskellPackages; [
30+ executableHaskellDepends = with haskellPackages; [
33− aeson base bytestring Cabal containers deepseq deepseq-generics
31+ aeson ansi-wl-pprint base bytestring Cabal containers data-default
34− directory doctest filepath hackage-db hspec monad-par
32+ deepseq deepseq-generics directory doctest filepath hackage-db
35− monad-par-extras mtl pretty process QuickCheck pretty-show
33+ hspec lens monad-par monad-par-extras mtl optparse-applicative
36− regex-posix SHA split transformers utf8-string data-default
34+ pretty process regex-posix SHA split transformers utf8-string
37 ];
35 ];
36+ testHaskellDepends = with haskellPackages; [
37+ aeson ansi-wl-pprint base bytestring Cabal containers data-default
38+ deepseq deepseq-generics directory doctest filepath hackage-db
39+ hspec lens monad-par monad-par-extras mtl optparse-applicative
40+ pretty process regex-posix SHA split transformers utf8-string
41+ ];
38− homepage = "http://github.com/NixOS/cabal2nix";
42+ homepage = "https://github.com/nixos/cabal2nix#readme";
39 description = "Convert Cabal files into Nix build instructions";
43 description = "Convert Cabal files into Nix build instructions";
40 license = pkgs.stdenv.lib.licenses.bsd3;
44 license = pkgs.stdenv.lib.licenses.bsd3;
41 maintainers = [ pkgs.stdenv.lib.maintainers.simons ];
45 maintainers = [ pkgs.stdenv.lib.maintainers.simons ];
test/Main.hsnew file+65
@@ -0,0 +1,65 @@
1+module Main ( main ) where
2+
3+import Control.DeepSeq
4+import Control.Exception
5+import qualified Data.Map as Map
6+import qualified Data.Set as Set
7+import Distribution.Nixpkgs.Haskell.FromCabal.Configuration.GHC7102
8+import Distribution.Nixpkgs.License
9+import Distribution.Nixpkgs.Meta
10+import Internal.Lens
11+import Test.Hspec
12+import Test.DocTest
13+
14+main :: IO ()
15+main = do
16+ doctest [ "-isrc", "-optP-include", "-optPdist/build/autogen/cabal_macros.h"
17+ , "src/Distribution/Nixpkgs/Fetch.hs"
18+ , "src/Distribution/Nixpkgs/Haskell.hs"
19+ , "src/Distribution/Nixpkgs/Haskell/BuildInfo.hs"
20+ , "src/Distribution/Nixpkgs/Haskell/Constraint.hs"
21+ , "src/Distribution/Nixpkgs/Haskell/Derivation.hs"
22+ , "src/Distribution/Nixpkgs/Haskell/FromCabal.hs"
23+ , "src/Distribution/Nixpkgs/Haskell/FromCabal/Configuration.hs"
24+ , "src/Distribution/Nixpkgs/Haskell/FromCabal/Configuration/GHC7102.hs"
25+ , "src/Distribution/Nixpkgs/Haskell/FromCabal/Configuration/Maintainers.hs"
26+ , "src/Distribution/Nixpkgs/Haskell/FromCabal/Flags.hs"
27+ , "src/Distribution/Nixpkgs/Haskell/FromCabal/License.hs"
28+ , "src/Distribution/Nixpkgs/Haskell/FromCabal/Name.hs"
29+ , "src/Distribution/Nixpkgs/Haskell/FromCabal/Normalize.hs"
30+ , "src/Distribution/Nixpkgs/Haskell/FromCabal/PostProcess.hs"
31+ , "src/Distribution/Nixpkgs/Haskell/Hackage.hs"
32+ , "src/Distribution/Nixpkgs/Haskell/HackageGit.hs"
33+ , "src/Distribution/Nixpkgs/Haskell/OrphanInstances.hs"
34+ , "src/Distribution/Nixpkgs/License.hs"
35+ , "src/Distribution/Nixpkgs/Meta.hs"
36+ , "src/Distribution/Nixpkgs/PackageMap.hs"
37+ , "src/Internal/HaskellPackage.hs"
38+ , "src/Internal/Lens.hs"
39+ , "src/Internal/PrettyPrinting.hs"
40+ , "src/Language/Nix.hs"
41+ , "src/Language/Nix/Binding.hs"
42+ , "src/Language/Nix/Identifier.hs"
43+ , "src/Language/Nix/Path.hs"
44+ ]
45+ doctest ["-isrc", "-optP-include", "-optPdist/build/autogen/cabal_macros.h", "cabal2nix/Main.hs"]
46+ doctest ["-isrc", "-optP-include", "-optPdist/build/autogen/cabal_macros.h", "hackage2nix/Main.hs"]
47+
48+ hspec $ do
49+ describe "DeepSeq instances work properly for" $ do
50+ it "License" $ mapM_ hitsBottom [Known undefined, Unknown (Just undefined)]
51+ it "Meta" $ do mapM_ hitsBottom
52+ [ def & homepage .~ undefined
53+ , def & description .~ undefined
54+ , def & license .~ undefined
55+ , def & platforms .~ undefined
56+ , def & maintainers .~ undefined
57+ , def & broken .~ undefined
58+ ]
59+
60+ describe "Configuration records are consistent" $
61+ it "No maintained package is marked as \"dont-distribute\"" $
62+ Map.keysSet (packageMaintainers ghc7102) `Set.intersection` (dontDistributePackages ghc7102) `shouldSatisfy` Set.null
63+
64+hitsBottom :: NFData a => a -> Expectation
65+hitsBottom x = evaluate (rnf x) `shouldThrow` anyErrorCall
test/spec.hsdeleted−32
@@ -1,32 +0,0 @@
1−module Main ( main ) where
2−
3−import Control.DeepSeq
4−import Control.Exception
5−import qualified Data.Map as Map
6−import qualified Data.Set as Set
7−import Distribution.Nixpkgs.Haskell.FromCabal.Configuration.GHC7102
8−import Distribution.Nixpkgs.License
9−import Distribution.Nixpkgs.Meta
10−import Internal.Lens
11−import Test.Hspec
12−
13−main :: IO ()
14−main = do
15− hspec $ do
16− describe "DeepSeq instances work properly for" $ do
17− it "License" $ mapM_ hitsBottom [Known undefined, Unknown (Just undefined)]
18− it "Meta" $ do mapM_ hitsBottom
19− [ def & homepage .~ undefined
20− , def & description .~ undefined
21− , def & license .~ undefined
22− , def & platforms .~ undefined
23− , def & maintainers .~ undefined
24− , def & broken .~ undefined
25− ]
26−
27− describe "Configuration records are consistent" $
28− it "No maintained package is marked as \"dont-distribute\"" $
29− Map.keysSet (packageMaintainers ghc7102) `Set.intersection` (dontDistributePackages ghc7102) `shouldSatisfy` Set.null
30−
31−hitsBottom :: NFData a => a -> Expectation
32−hitsBottom x = evaluate (rnf x) `shouldThrow` anyErrorCall
update-nixpkgs.sh−1
@@ -36,7 +36,6 @@ gzip -k "$TAR"
36hackage=$(git rev-parse --verify HEAD)
36hackage=$(git rev-parse --verify HEAD)
37cd ..
37cd ..
38
38
39−rm -f cabal2nix
40make --quiet configure
39make --quiet configure
41cabal run -v0 -j hackage2nix >hackage-packages.nix
40cabal run -v0 -j hackage2nix >hackage-packages.nix
42
41