From b4203b2e4d04fce5a921421810ab1c210a9fb810 Mon Sep 17 00:00:00 2001 From: Anton-Latukha Date: Mon, 15 Mar 2021 22:06:58 +0200 Subject: [PATCH 1/5] treewide: "@ '" -> "@'" Should fix builds for GHC 9.0. --- hnix-store-core/src/System/Nix/ReadonlyStore.hs | 6 ++++-- hnix-store-remote/tests/Derivation.hs | 2 +- hnix-store-remote/tests/NixDaemon.hs | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/hnix-store-core/src/System/Nix/ReadonlyStore.hs b/hnix-store-core/src/System/Nix/ReadonlyStore.hs index 0b4df3d..ad966ae 100644 --- a/hnix-store-core/src/System/Nix/ReadonlyStore.hs +++ b/hnix-store-core/src/System/Nix/ReadonlyStore.hs @@ -45,7 +45,9 @@ makeTextPath fp nm h refs = makeStorePath fp ty h nm makeFixedOutputPath :: forall hashAlgo - . (ValidAlgo hashAlgo, NamedAlgo hashAlgo) + . ( ValidAlgo hashAlgo + , NamedAlgo hashAlgo + ) => FilePath -> Bool -> Digest hashAlgo @@ -57,7 +59,7 @@ makeFixedOutputPath fp recursive h = else makeStorePath fp "output:out" h' where h' = - hash @ 'SHA256 + hash @'SHA256 $ "fixed:out:" <> encodeUtf8 (algoName @hashAlgo) <> (if recursive then ":r:" else ":") diff --git a/hnix-store-remote/tests/Derivation.hs b/hnix-store-remote/tests/Derivation.hs index 27d6d4b..d86b002 100644 --- a/hnix-store-remote/tests/Derivation.hs +++ b/hnix-store-remote/tests/Derivation.hs @@ -48,7 +48,7 @@ withBash action = do Nothing -> error "No bash executable found" Just fp -> do let Right n = System.Nix.StorePath.makeStorePathName "bash" - pth <- addToStore @ 'SHA256 n fp False (pure True) False + pth <- addToStore @'SHA256 n fp False (pure True) False action pth withBuildScript :: (StorePath -> MonadStore a) -> MonadStore a diff --git a/hnix-store-remote/tests/NixDaemon.hs b/hnix-store-remote/tests/NixDaemon.hs index f98b3ba..2e354e0 100644 --- a/hnix-store-remote/tests/NixDaemon.hs +++ b/hnix-store-remote/tests/NixDaemon.hs @@ -259,7 +259,7 @@ spec_protocol = Hspec.around withNixDaemon $ itRights "adds file to store" $ do fp <- liftIO $ writeSystemTempFile "addition" "lal" let Right n = makeStorePathName "tmp-addition" - res <- addToStore @ 'SHA256 n fp False (pure True) False + res <- addToStore @'SHA256 n fp False (pure True) False liftIO $ print res context "with dummy" $ do From c677ecdb3bfe82e3bd8323e2cb37efe028e9ba58 Mon Sep 17 00:00:00 2001 From: Anton-Latukha Date: Tue, 16 Mar 2021 10:53:20 +0200 Subject: [PATCH 2/5] Core: cabal: make `-rtsopts` a part of the `bounded-memory` flag --- hnix-store-core/hnix-store-core.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hnix-store-core/hnix-store-core.cabal b/hnix-store-core/hnix-store-core.cabal index b725f97..de3fd1a 100644 --- a/hnix-store-core/hnix-store-core.cabal +++ b/hnix-store-core/hnix-store-core.cabal @@ -79,7 +79,7 @@ test-suite format-tests import: commons if flag(bounded_memory) cpp-options: -DBOUNDED_MEMORY - ghc-options: -rtsopts -fprof-auto + ghc-options: -rtsopts -fprof-auto type: exitcode-stdio-1.0 main-is: Driver.hs other-modules: From 9dd468cbe2b35719c0a344b925c7017afc3f014b Mon Sep 17 00:00:00 2001 From: Anton-Latukha Date: Tue, 16 Mar 2021 10:54:23 +0200 Subject: [PATCH 3/5] Core: cabal: layout --- hnix-store-core/hnix-store-core.cabal | 111 +++++++++++++------------- 1 file changed, 57 insertions(+), 54 deletions(-) diff --git a/hnix-store-core/hnix-store-core.cabal b/hnix-store-core/hnix-store-core.cabal index de3fd1a..ddc402f 100644 --- a/hnix-store-core/hnix-store-core.cabal +++ b/hnix-store-core/hnix-store-core.cabal @@ -3,9 +3,9 @@ name: hnix-store-core version: 0.4.2.0 synopsis: Core effects for interacting with the Nix store. description: - This package contains types and functions needed to describe - interactions with the Nix store abstracted away from - specific effectful context. + This package contains types and functions needed to describe + interactions with the Nix store abstracted away from + specific effectful context. homepage: https://github.com/haskell-nix/hnix-store license: Apache-2.0 license-file: LICENSE @@ -14,10 +14,11 @@ maintainer: shea@shealevy.com copyright: 2018 Shea Levy category: Nix build-type: Simple -extra-source-files: ChangeLog.md - , README.md - , tests/samples/example0.drv - , tests/samples/example1.drv +extra-source-files: + ChangeLog.md + , README.md + , tests/samples/example0.drv + , tests/samples/example1.drv Common commons if impl(ghc >= 8.10) @@ -27,47 +28,49 @@ Common commons library import: commons - exposed-modules: System.Nix.Base32 - , System.Nix.Build - , System.Nix.Derivation - , System.Nix.Hash - , System.Nix.Internal.Base32 - , System.Nix.Internal.Hash - , System.Nix.Internal.Nar.Parser - , System.Nix.Internal.Nar.Streamer - , System.Nix.Internal.Nar.Effects - , System.Nix.Internal.Signature - , System.Nix.Internal.StorePath - , System.Nix.Nar - , System.Nix.ReadonlyStore - , System.Nix.Signature - , System.Nix.StorePath - , System.Nix.StorePathMetadata - build-depends: base >=4.10 && <5 - , attoparsec - , algebraic-graphs >= 0.5 && < 0.6 - , base16-bytestring - , base64-bytestring - , bytestring - , cereal - , containers - , cryptohash-md5 - , cryptohash-sha1 - , cryptohash-sha256 - , cryptohash-sha512 - , directory - , filepath - , hashable - , lifted-base - , monad-control - , mtl - , nix-derivation >= 1.1.1 && <2 - , saltine - , time - , text - , unix - , unordered-containers - , vector + exposed-modules: + System.Nix.Base32 + , System.Nix.Build + , System.Nix.Derivation + , System.Nix.Hash + , System.Nix.Internal.Base32 + , System.Nix.Internal.Hash + , System.Nix.Internal.Nar.Parser + , System.Nix.Internal.Nar.Streamer + , System.Nix.Internal.Nar.Effects + , System.Nix.Internal.Signature + , System.Nix.Internal.StorePath + , System.Nix.Nar + , System.Nix.ReadonlyStore + , System.Nix.Signature + , System.Nix.StorePath + , System.Nix.StorePathMetadata + build-depends: + base >=4.10 && <5 + , attoparsec + , algebraic-graphs >= 0.5 && < 0.6 + , base16-bytestring + , base64-bytestring + , bytestring + , cereal + , containers + , cryptohash-md5 + , cryptohash-sha1 + , cryptohash-sha256 + , cryptohash-sha512 + , directory + , filepath + , hashable + , lifted-base + , monad-control + , mtl + , nix-derivation >= 1.1.1 && <2 + , saltine + , time + , text + , unix + , unordered-containers + , vector hs-source-dirs: src default-language: Haskell2010 @@ -83,13 +86,13 @@ test-suite format-tests type: exitcode-stdio-1.0 main-is: Driver.hs other-modules: - Arbitrary - Derivation - NarFormat - Hash - StorePath + Arbitrary + Derivation + NarFormat + Hash + StorePath hs-source-dirs: - tests + tests build-tool-depends: tasty-discover:tasty-discover build-depends: From f323ba92898f5247e3f37c1e836c28c81591dd91 Mon Sep 17 00:00:00 2001 From: Anton-Latukha Date: Tue, 16 Mar 2021 10:57:38 +0200 Subject: [PATCH 4/5] Remote: cabal: layout --- hnix-store-remote/hnix-store-remote.cabal | 90 ++++++++++++----------- 1 file changed, 47 insertions(+), 43 deletions(-) diff --git a/hnix-store-remote/hnix-store-remote.cabal b/hnix-store-remote/hnix-store-remote.cabal index 5b1d2bc..917f751 100644 --- a/hnix-store-remote/hnix-store-remote.cabal +++ b/hnix-store-remote/hnix-store-remote.cabal @@ -28,27 +28,29 @@ flag io-testsuite library import: commons - exposed-modules: System.Nix.Store.Remote - , System.Nix.Store.Remote.Binary - , System.Nix.Store.Remote.Builders - , System.Nix.Store.Remote.Logger - , System.Nix.Store.Remote.Parsers - , System.Nix.Store.Remote.Protocol - , System.Nix.Store.Remote.Types - , System.Nix.Store.Remote.Util + exposed-modules: + System.Nix.Store.Remote + , System.Nix.Store.Remote.Binary + , System.Nix.Store.Remote.Builders + , System.Nix.Store.Remote.Logger + , System.Nix.Store.Remote.Parsers + , System.Nix.Store.Remote.Protocol + , System.Nix.Store.Remote.Types + , System.Nix.Store.Remote.Util - build-depends: base >=4.10 && <5 - , attoparsec - , binary - , bytestring - , containers - , text - , time - , network - , nix-derivation >= 1.1.1 && <2 - , mtl - , unordered-containers - , hnix-store-core >= 0.4 && <0.5 + build-depends: + base >=4.10 && <5 + , attoparsec + , binary + , bytestring + , containers + , text + , time + , network + , nix-derivation >= 1.1.1 && <2 + , mtl + , unordered-containers + , hnix-store-core >= 0.4 && <0.5 hs-source-dirs: src default-language: Haskell2010 ghc-options: -Wall @@ -62,30 +64,32 @@ test-suite hnix-store-remote-tests ghc-options: -rtsopts -fprof-auto type: exitcode-stdio-1.0 main-is: Driver.hs - other-modules: Derivation - , NixDaemon - , Spec - , Util + other-modules: + Derivation + , NixDaemon + , Spec + , Util hs-source-dirs: tests build-tool-depends: tasty-discover:tasty-discover - build-depends: base - , hnix-store-core >= 0.3 - , hnix-store-remote - , containers - , directory - , process - , filepath - , hspec-expectations-lifted - , quickcheck-text - , tasty - , tasty-hspec - , tasty-quickcheck - , linux-namespaces - , nix-derivation - , temporary - , text - , unix - , unordered-containers - , vector + build-depends: + base + , hnix-store-core >= 0.3 + , hnix-store-remote + , containers + , directory + , process + , filepath + , hspec-expectations-lifted + , quickcheck-text + , tasty + , tasty-hspec + , tasty-quickcheck + , linux-namespaces + , nix-derivation + , temporary + , text + , unix + , unordered-containers + , vector default-language: Haskell2010 From b36c5857ef9ceb2bd0d34e639b00077c15b250e9 Mon Sep 17 00:00:00 2001 From: Anton-Latukha Date: Tue, 16 Mar 2021 10:57:54 +0200 Subject: [PATCH 5/5] Remote: cabal: move `-rtsoptos` into testsuite flag --- hnix-store-remote/hnix-store-remote.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hnix-store-remote/hnix-store-remote.cabal b/hnix-store-remote/hnix-store-remote.cabal index 917f751..79aae17 100644 --- a/hnix-store-remote/hnix-store-remote.cabal +++ b/hnix-store-remote/hnix-store-remote.cabal @@ -60,8 +60,8 @@ test-suite hnix-store-remote-tests if !flag(io-testsuite) buildable: False + ghc-options: -rtsopts -fprof-auto - ghc-options: -rtsopts -fprof-auto type: exitcode-stdio-1.0 main-is: Driver.hs other-modules: