Skip to content

Commit f1741e8

Browse files
authored
Merge pull request #241 from haskell-nix/srk/split
Split core into multiple packages
2 parents 9118c30 + 13064a9 commit f1741e8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+778
-404
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
dist
22
dist-newstyle
33
.ghc.environment*
4+
.ghci
5+
.ghci_history
46
.direnv
7+
.envrc
58
cabal.project.local~
69
cabal.project.local
710
attic

cabal.project

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ packages:
22
./hnix-store-core/hnix-store-core.cabal
33
./hnix-store-db/hnix-store-db.cabal
44
./hnix-store-remote/hnix-store-remote.cabal
5+
./hnix-store-tests/hnix-store-tests.cabal
56

67
-- till https://github.com/obsidiansystems/dependent-sum/pull/80
78
allow-newer:

cabal.project.local.ci

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,6 @@ package hnix-store-db
88

99
package hnix-store-remote
1010
ghc-options: -Wunused-packages -Wall -Werror
11+
12+
package hnix-store-tests
13+
ghc-options: -Wunused-packages -Wall -Werror

default.nix

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ in {
2222
inherit (haskellPackages)
2323
hnix-store-core
2424
hnix-store-db
25-
hnix-store-remote;
25+
hnix-store-remote
26+
hnix-store-tests;
2627
haskellPackages = lib.dontRecurseIntoAttrs haskellPackages;
2728
pkgs = lib.dontRecurseIntoAttrs pkgs;
2829
}

hnix-store-core/.envrc

Lines changed: 0 additions & 1 deletion
This file was deleted.

hnix-store-core/.ghci

Lines changed: 0 additions & 1 deletion
This file was deleted.

hnix-store-core/hnix-store-core.cabal

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
cabal-version: 2.2
22
name: hnix-store-core
3-
version: 0.7.0.0
3+
version: 0.8.0.0
44
synopsis: Core effects for interacting with the Nix store.
55
description:
66
This package contains types and functions needed to describe
@@ -38,7 +38,6 @@ common commons
3838
, FlexibleContexts
3939
, FlexibleInstances
4040
, GADTs
41-
, StandaloneDeriving
4241
, ScopedTypeVariables
4342
, StandaloneDeriving
4443
, RecordWildCards
@@ -80,8 +79,8 @@ library
8079
base >=4.12 && <5
8180
, attoparsec
8281
, algebraic-graphs >= 0.5 && < 0.8
83-
, base16-bytestring
84-
, base64-bytestring
82+
, base16-bytestring >= 1.0
83+
, base64-bytestring >= 1.2.1
8584
, bytestring
8685
, case-insensitive
8786
, cereal
@@ -90,7 +89,6 @@ library
9089
, data-default-class
9190
, dependent-sum > 0.7
9291
, dependent-sum-template > 0.1.1 && < 0.3
93-
, generic-arbitrary < 1.1
9492
-- Required for cryptonite low-level type convertion
9593
, memory
9694
, cryptonite
@@ -101,8 +99,6 @@ library
10199
, monad-control
102100
, mtl
103101
, nix-derivation >= 1.1.1 && <2
104-
, QuickCheck
105-
, quickcheck-instances
106102
, saltine >= 0.2 && < 0.3
107103
, some > 1.0.5 && < 2
108104
, time
@@ -125,11 +121,8 @@ test-suite format-tests
125121
main-is: Driver.hs
126122
other-modules:
127123
Derivation
128-
DerivedPath
129-
ContentAddress
130124
NarFormat
131125
Hash
132-
StorePath
133126
hs-source-dirs:
134127
tests
135128
build-tool-depends:
@@ -148,7 +141,6 @@ test-suite format-tests
148141
, directory
149142
, filepath
150143
, process
151-
, nix-derivation >= 1.1.1 && <2
152144
, tasty
153145
, tasty-golden
154146
, hspec

hnix-store-core/shell.nix

Lines changed: 0 additions & 1 deletion
This file was deleted.

hnix-store-core/src/System/Nix/Base.hs

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
{-# LANGUAGE CPP #-}
2-
31
module System.Nix.Base
42
( BaseEncoding(Base16,NixBase32,Base64)
53
, encodeWith
@@ -19,7 +17,8 @@ import qualified System.Nix.Base32 -- Nix has own Base32 encoding
1917
data BaseEncoding
2018
= NixBase32
2119
-- | ^ Nix has a special map of Base32 encoding
22-
-- Placed first, since it determines Haskell optimizations of pattern matches, & NixBase seems be the most widely used in Nix.
20+
-- Placed first, since it determines Haskell optimizations of pattern matches,
21+
-- & NixBase seems be the most widely used in Nix.
2322
| Base16
2423
| Base64
2524

@@ -35,18 +34,9 @@ encodeWith Base64 =
3534

3635
-- | Take the input & @Base@ encoding witness -> decode into @Text@.
3736
decodeWith :: BaseEncoding -> Text -> Either String ByteString
38-
#if MIN_VERSION_base16_bytestring(1,0,0)
3937
decodeWith Base16 =
40-
Data.ByteString.Base16.decode
38+
Data.ByteString.Base16.decode
4139
. Data.Text.Encoding.encodeUtf8
42-
#else
43-
decodeWith Base16 = lDecode -- this tacit sugar simply makes GHC pleased with number of args
44-
where
45-
lDecode t =
46-
case Data.ByteString.Base16.decode (Data.Text.Encoding.encodeUtf8 t) of
47-
(x, "") -> pure $ x
48-
_ -> Left $ "Unable to decode base16 string" <> toString t
49-
#endif
5040
decodeWith NixBase32 = System.Nix.Base32.decode
5141
decodeWith Base64 =
5242
Data.ByteString.Base64.decode

hnix-store-core/src/System/Nix/Build.hs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
-- due to recent generic-arbitrary
2-
{-# OPTIONS_GHC -fconstraint-solver-iterations=0 #-}
31
{-|
42
Description : Build related types
53
Maintainer : srk <[email protected]>
@@ -14,15 +12,11 @@ module System.Nix.Build
1412
import Data.Time (UTCTime)
1513
import Data.Text (Text)
1614
import GHC.Generics (Generic)
17-
import Test.QuickCheck (Arbitrary(..))
18-
import Test.QuickCheck.Arbitrary.Generic (GenericArbitrary(..))
19-
import Test.QuickCheck.Instances ()
2015

2116
-- keep the order of these Enums to match enums from reference implementations
2217
-- src/libstore/store-api.hh
2318
data BuildMode = Normal | Repair | Check
2419
deriving (Eq, Generic, Ord, Enum, Show)
25-
deriving Arbitrary via GenericArbitrary BuildMode
2620

2721
data BuildStatus =
2822
Built
@@ -41,7 +35,6 @@ data BuildStatus =
4135
| ResolvesToAlreadyValid
4236
| NoSubstituters
4337
deriving (Eq, Generic, Ord, Enum, Show)
44-
deriving Arbitrary via GenericArbitrary BuildStatus
4538

4639
-- | Result of the build
4740
data BuildResult = BuildResult
@@ -59,7 +52,6 @@ data BuildResult = BuildResult
5952
stopTime :: !UTCTime
6053
}
6154
deriving (Eq, Generic, Ord, Show)
62-
deriving Arbitrary via GenericArbitrary BuildResult
6355

6456
buildSuccess :: BuildResult -> Bool
6557
buildSuccess BuildResult {..} =

0 commit comments

Comments
 (0)