Core effects for interacting with the Nix store.

Version on this page:
LTS Haskell 17.15:
Stackage Nightly 2022-02-07:
Latest on Hackage:

See all snapshots hnix-store-core appears in

Apache-2.0 licensed by Shea Levy
Maintained by
This version can be pinned in stack with:hnix-store-core-,3112


Core effects for interacting with the Nix store.

See NarEffects in System.Nix.Internal.Nar.Effects and the System.Nix.StorePath for the available operations on the store.


  • ghcid --command "cabal repl test-suite:format-tests" --test="Main.main"


ChangeLog 2021-06-10

  • Breaking:

    • System.Nix.Hash:
      • (link) Migration from packages cryptohash- -> cryptonite:
        • rm newtype Digest in favour of cryptonite: newtype Digest
        • rm data HashAlgorithm in favour of cryptonite: class HashAlgorithm
        • rm class ValidAlgo in favour of cryptonite: class HashAlgorithm.
        • class NamedAlgo removed hashSize in favour of cryptonite: class HashAlgorithm: hashDigestSize. Former became a subclass of the latter.
        • rm hash in favour of cryptonite: hash
        • rm hashLazy in favour of cryptonite: hashlazy
      • (link) Base encoding/decoding function for hashes (digests) changed (due to changes in type system & separation of specially truncated Nix Store hasing):
        • encode(InBase -> DigestWith)
        • decode(Base -> DigestWith)
    • (link) System.Nix.StorePath:
      • rm type StorePathHashAlgo = 'Truncated 20 'SHA256 in favour of StorePathHashPart & mkStorePathHashPart.
      • rm unStorePathName, please use GHC: coerce for StorePathName <-> Text, StorePathName data constructor is provided.
    • Internal modules now have export lists, if something, please contact.
  • Additional:

    • (link) Support of GHC 9.0.

    • (link) System.Nix.StorePath:

      • exposed StorePathName data constructor to API.
      • added newtype StorePathHashPart = StorePathHashPart ByteString.
        • added builder mkStorePathHashPart :: ByteString -> StorePathHashPart
    • (link) System.Nix.Hash:

      • Nix store (which are specially truncated) hashes are now handled separately from other hashes:
        • add mkStorePathHash - a function to create a content into Nix storepath-style hash: mkStorePathHash :: HashAlgorithm a => ByteString -> ByteString but recommend to at once use mkStorePathHashPart. 2021-05-30

  • Additional:
    • (link) System.Nix.ReadonlyStore: add a readonly computeStorePathForPath
    • (link) System.Nix.ReadonlyStore: computeStorePathForPath: force SHA256 as it’s the only valid choice
    • (link): makeTextPath: order the references 2021-03-12

  • Additional:

    • (link) Cabal now properly states tasty-discover as build-tool-depends.

    • (link) added explicit hie.yml cradle description for cabal to help Haskell Language Server to work with monorepo.

    • (link) rm vacuous Setup.hs, it was throwing-off HLS, and anyway file is vacuous and gets deprecated by Cabal itself.

    • (link) Nix dev env: removed GHC 8.6.5 support, afaik it is not even in Nixpkgs anymore.

    • (link) Test suite: fixed nar test for the envs without /proc (test suite now works on macOS). 2021-01-16

  • Big clean-up of dependencies. 2020-12-30

  • System.Nix.Hash no longer exports encodeBase16, decodeBase16 and their Base32 counterparts. These were replaced by encodeInBase and decodeBase functions accepting BaseEncoding data type #87
  • Support base16-bytestring >= 1 #86 #100 – 2020-11-29

  • System.Nix.Nar changes API to support NAR format streaming:
    • buildNarIO :: FilePath -> Handle -> IO () - Create a NAR from a regular filesystem object, stream it out on the Handle
    • unpackNarIO :: Handle -> FilePath -> IO () - Recreate filesystem object from a NAR file accessed by the Handle
  • StorePath type changed to simple variant without type level symbolic store path root.
  • Added makeFixedOutputPath to System.Nix.ReadonlyStore
  • Added decodeBase16 and decodeBase32 to System.Nix.Hash
  • System.Nix.StorePath module now provides
    • storePathToFilePath and storePathToText helpers
    • storePathToNarInfo for converting paths to narinfo URLs
    • parsePath function
    • pathParser Attoparsec parser
  • Added System.Nix.Build module
  • Added System.Nix.Derivation module
  • Removed System.Nix.Util module, moved to hnix-store-remote
  • Added base64 and SHA512 hash support – 2020-03-12

Removed System.Nix.Store. We may reintroduce it later when multiple backends exist and we can tell what common effects they should share. – 2019-03-18

  • First version.