packages feed

hercules-ci-cnix-store 0.4.1.0 → 0.4.2.0

raw patch · 7 files changed

+158/−84 lines, 7 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

CHANGELOG.md view
@@ -5,206 +5,240 @@  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). -## 0.4.1.0 - 2026-01-06+## [0.4.2.0] - 2026-10-13  ### Added - - Nix 2.29 - 2.33 support+- Nix 2.34, 2.35 support -## 0.4.0.0 - 2025-07-18+## [0.4.1.0] - 2026-01-06 +### Added++- Nix 2.29 - 2.33 support++## [0.4.0.0] - 2025-07-18+ ### Changed - - `init` now installs synchronous signal handlers for you. You may remove your call to `installDefaultSigINTHandler`.- - The `nix-main` library dependency has been dropped. (if you don't also use `hercules-ci-cnix-expr`)+- `init` now installs synchronous signal handlers for you. You may remove your call to `installDefaultSigINTHandler`.+- The `nix-main` library dependency has been dropped. (if you don't also use `hercules-ci-cnix-expr`) -## 0.3.7.0 - 2025-05-05+## [0.3.7.0] - 2025-05-05  ### Added - - `getMaxBuildJobs`- - Nix 2.28 support+- `getMaxBuildJobs`+- Nix 2.28 support -## 0.3.6.1 - 2024-11-15+## [0.3.6.1] - 2024-11-15  ### Added - - Nix 2.24 support+- Nix 2.24 support -## 0.3.6.0 - 2024-05-19+## [0.3.6.0] - 2024-05-19  ### Added - - `Hercules.CNix.Memory` module, containing type classes and helpers for common memory management tasks.+- `Hercules.CNix.Memory` module, containing type classes and helpers for common memory management tasks. -### Fixed+### Removed - - Memory safety stability improvements- - Cleaned up haddocks+- Certain unintentional exports have been deprecated; see haddocks -### Removed+### Fixed - - Certain unintentional exports have been deprecated; see haddocks+- Memory safety stability improvements+- Cleaned up haddocks -## 0.3.5.1 - 2024-05-03+## [0.3.5.1] - 2024-05-03  ### Fixed - - Remove most uses of `c_str()`, of which at least one exhibited undefined behavior.+- Remove most uses of `c_str()`, of which at least one exhibited undefined behavior. -## 0.3.5.0 - 2024-02-12+## [0.3.5.0] - 2024-02-12  ### Added - - `queryPathInfoFromClientCache`+- `queryPathInfoFromClientCache` - - Nix support 2.17 up to 2.20+- Nix support 2.17 up to 2.20 - - A `both` function to combine `Verbosity`+- A `both` function to combine `Verbosity` -## 0.3.4.0 - 2023-06-28+## [0.3.4.0] - 2023-06-28  ### Added - - Nix 2.16 support+- Nix 2.16 support - - Nix 2.15 support+- Nix 2.15 support - - `getUseSQLiteWAL` low level function. (Use of Nix sqlite files is not recommended)+- `getUseSQLiteWAL` low level function. (Use of Nix sqlite files is not recommended) -## 0.3.3.5 - 2023-03-06+## [0.3.3.5] - 2023-03-06  ### Added - - Nix 2.14 support+- Nix 2.14 support - - Nix 2.13 support+- Nix 2.13 support -## 0.3.3.4 - 2023-03-06+## [0.3.3.4] - 2023-03-06  A dud. -## 0.3.3.3 - 2022-12-29+## [0.3.3.3] - 2022-12-29  ### Added - - Nix 2.12 support+- Nix 2.12 support -## 0.3.3.2 - 2022-11-15+## [0.3.3.2] - 2022-11-15  ### Added - - Nix 2.11 support+- Nix 2.11 support -## 0.3.3.1 - 2022-07-21+## [0.3.3.1] - 2022-07-21  ### Added - - Nix 2.10 support+- Nix 2.10 support -## 0.3.3.0 - 2022-06-21+## [0.3.3.0] - 2022-06-21  ### Added - - Nix 2.9 support+- Nix 2.9 support -## 0.3.2.0 - 2022-05-17+## [0.3.2.0] - 2022-05-17  ### Added - - Nix 2.8 support+- Nix 2.8 support -## 0.3.1.0 - 2022-04-08+## [0.3.1.0] - 2022-04-08  ### Added - - `addTemporaryRoot`: add a store gc root for the duration of the process.+- `addTemporaryRoot`: add a store gc root for the duration of the process. - - `isValidPath`: a simple alternative to `queryPathInfo` for simple needs.+- `isValidPath`: a simple alternative to `queryPathInfo` for simple needs. -## 0.3.0.1 - 2022-03-21+## [0.3.0.1] - 2022-03-21  ### Removed - - Clean up inline-c generated exports+- Clean up inline-c generated exports -## 0.3.0.0 - 2022-03-15+## [0.3.0.0] - 2022-03-15  ### Added - - `setVerbosity`- - `handleException` so your program's exception handling can match that of the Nix CLI+- `setVerbosity`+- `handleException` so your program's exception handling can match that of the Nix CLI  ### Removed - - Nix 2.3 support+- Nix 2.3 support -## 0.2.1.2 - 2022-03-07+## [0.2.1.2] - 2022-03-07 -### Fixed+### Added - - Build with newer Nix versions 2.5, 2.6+- Improved conditional code support with `cabal-pkg-config-version-hook` -### Added+### Fixed - - Improved conditional code support with `cabal-pkg-config-version-hook`+- Build with newer Nix versions 2.5, 2.6 -## 0.2.1.1 - 2021-11-17+## [0.2.1.1] - 2021-11-17  ### Fixed - - Remove unnecessary/unused/wrong compat helper in internal code+- Remove unnecessary/unused/wrong compat helper in internal code -## 0.2.1.0 - 2021-09-06+## [0.2.1.0] - 2021-09-06  ### Added - - `installDefaultSigINTHandler`+- `installDefaultSigINTHandler` -### Fixed+### Changed - - Interrupt handling+- Updated to work with a newer `nixUnstable` -### Changed+### Fixed - - Updated to work with a newer `nixUnstable`+- Interrupt handling -## 0.2.0.1 - 2021-06-16+## [0.2.0.1] - 2021-06-16  ### Fixed - - Missing file in sdist+- Missing file in sdist -## 0.2.0.0 - 2021-06-16+## [0.2.0.0] - 2021-06-16  ### Added - - Speculative support for nixUnstable+- Speculative support for nixUnstable - - `StorePath` (compatible for stable Nix)+- `StorePath` (compatible for stable Nix) - - Use and build on inline-c-cpp's TemplateHaskell-based template support+- Use and build on inline-c-cpp's TemplateHaskell-based template support - - `nixVersion`, `storeDir`+- `nixVersion`, `storeDir` - - Some settings getters+- Some settings getters  ### Changed - - Many functions now work with `StorePath` instead of plain paths+- Many functions now work with `StorePath` instead of plain paths - - Some functions now need a `Store` because of the `StorePath` change+- Some functions now need a `Store` because of the `StorePath` change  -## 0.1.1.0 - 2021-04-21+## [0.1.1.0] - 2021-04-21  ### Added - - Functions for retrieving the Nix daemon protocol versions- - Functions for interacting with the interrupt handler+- Functions for retrieving the Nix daemon protocol versions+- Functions for interacting with the interrupt handler -## 0.1.0.0 - 2021-03-05+## [0.1.0.0] - 2021-03-05  ### Added - - First code based mostly on Hercules CI Agent and some lines from the Cachix client.+- First code based mostly on Hercules CI Agent and some lines from the Cachix client.+++[0.4.1.0]: https://github.com/hercules-ci/hercules-ci-agent/commits/hercules-ci-cnix-store-0.4.1.0/hercules-ci-cnix-store+[0.4.0.0]: https://github.com/hercules-ci/hercules-ci-agent/commits/hercules-ci-cnix-store-0.4.0.0/hercules-ci-cnix-store+[0.3.7.0]: https://github.com/hercules-ci/hercules-ci-agent/commits/hercules-ci-cnix-store-0.3.7.0/hercules-ci-cnix-store+[0.3.6.1]: https://github.com/hercules-ci/hercules-ci-agent/commits/hercules-ci-cnix-store-0.3.6.1/hercules-ci-cnix-store+[0.3.6.0]: https://github.com/hercules-ci/hercules-ci-agent/commits/hercules-ci-cnix-store-0.3.6.0/hercules-ci-cnix-store+[0.3.5.1]: https://github.com/hercules-ci/hercules-ci-agent/commits/hercules-ci-cnix-store-0.3.5.1/hercules-ci-cnix-store+[0.3.5.0]: https://github.com/hercules-ci/hercules-ci-agent/commits/hercules-ci-cnix-store-0.3.5.0/hercules-ci-cnix-store+[0.3.4.0]: https://github.com/hercules-ci/hercules-ci-agent/commits/hercules-ci-cnix-store-0.3.4.0/hercules-ci-cnix-store+[0.3.3.5]: https://github.com/hercules-ci/hercules-ci-agent/commits/hercules-ci-cnix-store-0.3.3.5/hercules-ci-cnix-store+[0.3.3.4]: https://github.com/hercules-ci/hercules-ci-agent/commits/hercules-ci-cnix-store-0.3.3.4/hercules-ci-cnix-store+[0.3.3.3]: https://github.com/hercules-ci/hercules-ci-agent/commits/hercules-ci-cnix-store-0.3.3.3/hercules-ci-cnix-store+[0.3.3.2]: https://github.com/hercules-ci/hercules-ci-agent/commits/hercules-ci-cnix-store-0.3.3.2/hercules-ci-cnix-store+[0.3.3.1]: https://github.com/hercules-ci/hercules-ci-agent/commits/hercules-ci-cnix-store-0.3.3.1/hercules-ci-cnix-store+[0.3.3.0]: https://github.com/hercules-ci/hercules-ci-agent/commits/hercules-ci-cnix-store-0.3.3.0/hercules-ci-cnix-store+[0.3.2.0]: https://github.com/hercules-ci/hercules-ci-agent/commits/hercules-ci-cnix-store-0.3.2.0/hercules-ci-cnix-store+[0.3.1.0]: https://github.com/hercules-ci/hercules-ci-agent/commits/hercules-ci-cnix-store-0.3.1.0/hercules-ci-cnix-store+[0.3.0.1]: https://github.com/hercules-ci/hercules-ci-agent/commits/hercules-ci-cnix-store-0.3.0.1/hercules-ci-cnix-store+[0.3.0.0]: https://github.com/hercules-ci/hercules-ci-agent/commits/hercules-ci-cnix-store-0.3.0.0/hercules-ci-cnix-store+[0.2.1.2]: https://github.com/hercules-ci/hercules-ci-agent/commits/hercules-ci-cnix-store-0.2.1.2/hercules-ci-cnix-store+[0.2.1.1]: https://github.com/hercules-ci/hercules-ci-agent/commits/hercules-ci-cnix-store-0.2.1.1/hercules-ci-cnix-store+[0.2.1.0]: https://github.com/hercules-ci/hercules-ci-agent/commits/hercules-ci-cnix-store-0.2.1.0/hercules-ci-cnix-store+[0.2.0.1]: https://github.com/hercules-ci/hercules-ci-agent/commits/hercules-ci-cnix-store-0.2.0.1/hercules-ci-cnix-store+[0.2.0.0]: https://github.com/hercules-ci/hercules-ci-agent/commits/hercules-ci-cnix-store-0.2.0.0/hercules-ci-cnix-store+[0.1.1.0]: https://github.com/hercules-ci/hercules-ci-agent/commits/hercules-ci-cnix-store-0.1.1.0/hercules-ci-cnix-store+[0.1.0.0]: https://github.com/hercules-ci/hercules-ci-agent/commits/hercules-ci-cnix-store-0.1.0.0/hercules-ci-cnix-store+[Unreleased]: https://github.com/hercules-ci/hercules-ci-agent/commits/master/hercules-ci-cnix-store
hercules-ci-cnix-store.cabal view
@@ -1,7 +1,7 @@ cabal-version: 2.4  name:           hercules-ci-cnix-store-version:        0.4.1.0+version:        0.4.2.0 synopsis:       Haskell bindings for Nix's libstore category:       Nix homepage:       https://docs.hercules-ci.com@@ -98,7 +98,7 @@       include       cbits   pkgconfig-depends:-      nix-store >= 2.28 && < 2.34+      nix-store >= 2.28 && < 2.36   install-includes:       hercules-ci-cnix/store.hxx       hercules-ci-cnix/string.hxx
src/Hercules/CNix.hs view
@@ -39,10 +39,6 @@ C.include "<nix/store/derivations.hh>" C.include "<nix/store/globals.hh>" -C.include "<gc/gc.h>"-C.include "<gc/gc_cpp.h>"-C.include "<gc/gc_allocator.h>"- C.include "hercules-ci-cnix/string.hxx" C.include "hercules-ci-cnix/store.hxx" 
src/Hercules/CNix/Exception.hs view
@@ -15,6 +15,9 @@ import Protolude import qualified System.Environment +{- ORMOLU_DISABLE -}+-- It doesn't like CPP+ C.context context  C.include "<nix/store/globals.hh>"@@ -59,6 +62,9 @@     std::string error = ANSI_RED "error:" ANSI_NORMAL " ";     try {       try {+#if NIX_IS_AT_LEAST(2, 33, 0)+        std::rethrow_exception(eptr);+#else         try {           std::rethrow_exception(eptr);         } catch (...) {@@ -66,6 +72,7 @@           setInterruptThrown();           throw;         }+#endif       } catch (BaseError & e) {           logError(e.info());           return e.info().status;
src/Hercules/CNix/Settings.hs view
@@ -29,6 +29,9 @@ import qualified Language.C.Inline.Cpp as C import Protolude hiding (evalState, throwIO) +{- ORMOLU_DISABLE -}+-- It doesn't like CPP+ C.context   ( context       <> Std.Set.stdSetCtx@@ -41,6 +44,9 @@ C.include "<string>"  C.include "<nix/store/globals.hh>"+#if NIX_IS_AT_LEAST(2, 34, 0)+C.include "<nix/store/filetransfer.hh>"+#endif  C.include "hercules-ci-cnix/string.hxx" @@ -104,7 +110,11 @@ getMaxBuildJobs = do   n <-     [C.block| unsigned int {+#if NIX_IS_AT_LEAST(2, 34, 0)+      return nix::settings.getWorkerSettings().maxBuildJobs.get();+#else       return nix::settings.maxBuildJobs.get();+#endif     }|]   if (fromIntegral n :: Integer) > (fromIntegral (maxBound :: Word))     then panic ("Nix max-jobs is too large. Can't continue. Value: " <> show n :: Text)@@ -115,8 +125,13 @@   byteStringList     [C.block| std::vector<std::string>*{       auto r = new std::vector<std::string>();+#if NIX_IS_AT_LEAST(2, 34, 0)+      for (auto &i : nix::settings.getWorkerSettings().substituters.get())+        r->push_back(i.to_string());+#else       for (auto i : nix::settings.substituters.get())         r->push_back(i);+#endif       return r;     }|] @@ -133,14 +148,22 @@ getNarinfoCacheNegativeTtl :: IO Word64 getNarinfoCacheNegativeTtl =   [C.exp| uint64_t{+#if NIX_IS_AT_LEAST(2, 34, 0)+    nix::settings.getNarInfoDiskCacheSettings().ttlNegative.get()+#else     nix::settings.ttlNegativeNarInfoCache.get()+#endif   }|]  getNetrcFile :: IO ByteString getNetrcFile =   unsafePackMallocCString     =<< [C.exp| const char *{+#if NIX_IS_AT_LEAST(2, 34, 0)+      stringdup(nix::fileTransferSettings.netrcFile.get().string())+#else       stringdup(nix::settings.netrcFile.get())+#endif     }|]  -- Gets the value of https://nixos.org/manual/nix/stable/command-ref/conf-file.html?highlight=use-sqlite-wal#conf-use-sqlite-wal
src/Hercules/CNix/Store.hs view
@@ -294,12 +294,18 @@       return store.getProtocol();     }|] +{- ORMOLU_DISABLE -} getClientProtocolVersion :: IO Int getClientProtocolVersion =   fromIntegral     <$> [C.throwBlock| int {+#if NIX_IS_AT_LEAST(2, 34, 0)+      return WorkerProto::latest.number.toWire();+#else       return PROTOCOL_VERSION;+#endif     }|]+{- ORMOLU_ENABLE -}  -- | Store-agnostic store path representation: hash and name. Does not have a storedir or subpath inside the store path. newtype StorePath = StorePath (ForeignPtr NixStorePath)
src/Hercules/CNix/Util.hs view
@@ -23,6 +23,9 @@ import System.Posix (Handler (Catch), installHandler, sigHUP, sigINT, sigTERM, sigUSR1) import Prelude () +{- ORMOLU_DISABLE -}+-- It doesn't like CPP+ C.context context  C.include "<nix/util/signals.hh>"@@ -31,11 +34,16 @@  C.using "namespace nix" +{-# DEPRECATED setInterruptThrown "Nix 2.33 removed `setInterruptThrown()`, and the Haskell function is a no-op when built against 2.33 or later versions. An OS thread can no longer opt out of Nix interrupt delivery. When Nix's process-global interrupt flag is set (e.g. with `triggerInterrupt`), `checkInterrupt()` throws at every call, except during C++ stack unwinding. No equivalent exists. Check whether you meant to use `triggerInterrupt` instead. If you are absolutely sure you need `setInterruptThrown` semantics for your bound thread, contribute to Nix." #-} setInterruptThrown :: IO () setInterruptThrown =+#if NIX_IS_AT_LEAST(2, 33, 0)+  pass+#else   [C.throwBlock| void {     nix::setInterruptThrown();   }|]+#endif  triggerInterrupt :: IO () triggerInterrupt =