-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #231 from sorki/srk/cereal
remote: start transitioning from binary to cereal
- Loading branch information
Showing
31 changed files
with
920 additions
and
274 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,7 @@ | ||
packages: ./hnix-store-core/*.cabal ./hnix-store-remote/*.cabal | ||
packages: | ||
./hnix-store-core/hnix-store-core.cabal | ||
./hnix-store-remote/hnix-store-remote.cabal | ||
|
||
package hnix-store-remote | ||
flags: +build-readme +io-testsuite | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,5 @@ | ||
tests: True | ||
|
||
flags: +io-testsuite | ||
|
||
package hnix-store-core | ||
ghc-options: -Wunused-packages -Wall | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,48 @@ | ||
-- due to recent generic-arbitrary | ||
{-# OPTIONS_GHC -Wno-orphans -fconstraint-solver-iterations=0 #-} | ||
|
||
module System.Nix.Derivation | ||
( parseDerivation | ||
, buildDerivation | ||
) | ||
where | ||
) where | ||
|
||
import qualified Data.Text.Lazy.Builder as Text.Lazy | ||
( Builder ) | ||
import qualified Data.Attoparsec.Text.Lazy as Text.Lazy | ||
( Parser ) | ||
import Nix.Derivation ( Derivation ) | ||
import qualified Nix.Derivation as Derivation | ||
import System.Nix.StorePath ( StoreDir | ||
, StorePath | ||
, storePathToFilePath | ||
) | ||
import qualified System.Nix.StorePath as StorePath | ||
import Data.Attoparsec.Text.Lazy (Parser) | ||
import Data.Text.Lazy.Builder (Builder) | ||
import Test.QuickCheck (Arbitrary(..)) | ||
import Test.QuickCheck.Arbitrary.Generic (GenericArbitrary(..)) | ||
import Test.QuickCheck.Instances () | ||
|
||
import Nix.Derivation (Derivation, DerivationOutput) | ||
import System.Nix.StorePath (StoreDir, StorePath) | ||
|
||
import qualified Data.Attoparsec.Text.Lazy | ||
import qualified Data.Text.Lazy | ||
|
||
parseDerivation :: StoreDir -> Text.Lazy.Parser (Derivation StorePath Text) | ||
import qualified Nix.Derivation | ||
import qualified System.Nix.StorePath | ||
|
||
deriving via GenericArbitrary (Derivation StorePath Text) | ||
instance Arbitrary (Derivation StorePath Text) | ||
deriving via GenericArbitrary (DerivationOutput StorePath Text) | ||
instance Arbitrary (DerivationOutput StorePath Text) | ||
|
||
parseDerivation :: StoreDir -> Parser (Derivation StorePath Text) | ||
parseDerivation expectedRoot = | ||
Derivation.parseDerivationWith | ||
("\"" *> StorePath.pathParser expectedRoot <* "\"") | ||
Derivation.textParser | ||
Nix.Derivation.parseDerivationWith | ||
pathParser | ||
Nix.Derivation.textParser | ||
where | ||
pathParser = do | ||
text <- Nix.Derivation.textParser | ||
case Data.Attoparsec.Text.Lazy.parseOnly | ||
(System.Nix.StorePath.pathParser expectedRoot) | ||
(Data.Text.Lazy.fromStrict text) | ||
of | ||
Right p -> pure p | ||
Left e -> fail e | ||
|
||
buildDerivation :: StoreDir -> Derivation StorePath Text -> Text.Lazy.Builder | ||
buildDerivation :: StoreDir -> Derivation StorePath Text -> Builder | ||
buildDerivation storeDir = | ||
Derivation.buildDerivationWith | ||
(show . storePathToFilePath storeDir) | ||
Nix.Derivation.buildDerivationWith | ||
(show . System.Nix.StorePath.storePathToText storeDir) | ||
show |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.