hercules-ci-cnix-expr 0.5.1.0 → 0.5.2.0
raw patch · 3 files changed
+139/−73 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- CHANGELOG.md +105/−59
- hercules-ci-cnix-expr.cabal +5/−5
- src/Hercules/CNix/Expr.hs +29/−9
CHANGELOG.md view
@@ -5,162 +5,208 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). -## 0.5.1.0 - 2026-01-06+## [0.5.2.0] - 2026-10-13 +### Added++- Nix 2.34, 2.35 support++## [0.5.1.0] - 2026-01-06++### Added+ - Nix support up to 2.33 -## 0.5.0.0 - 2025-07-18+## [0.5.0.0] - 2025-07-18 +### Changed+ - `init` now installs synchronous signal handlers for you. You may remove your call to `installDefaultSigINTHandler`. -## 0.4.0.0 - 2025-05-05+## [0.4.0.0] - 2025-05-05 -- **REMOVE** `evalArgs`. This removes a dependency on the otherwise unused nix-cmd library. Use `valueFromExpressionString` and a library like `optparse-applicative` instead to create a nicer user experience.+### Added+ - Nix 2.28 support -## 0.3.6.5 - 2024-11-15+### Removed +- `evalArgs`. This removes a dependency on the otherwise unused nix-cmd library. Use `valueFromExpressionString` and a library like `optparse-applicative` instead to create a nicer user experience.++## [0.3.6.5] - 2024-11-15++### Added+ - Nix 2.24 support This includes the newly separate `nix-flake` library as a dependency of `hercules-ci-cnix-expr`. -## 0.3.6.4 - 2024-06-12+## [0.3.6.4] - 2024-06-12 -Got rid of unnecessary data files, improving packaging.+### Removed -## 0.3.6.3 - 2024-05-19+- Unnecessary data files, improving packaging. -Solve build warnings.+## [0.3.6.3] - 2024-05-19 -## 0.3.6.2 - 2024-05-03+### Fixed +- Build warnings.++## [0.3.6.2] - 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.6.1 - 2024-02-12+## [0.3.6.1] - 2024-02-12 ### Added - Nix support up to 2.20 -## 0.3.6.0 - 2023-06-28+## [0.3.6.0] - 2023-06-28 ### Added - - `allowThreads`, `runInGcSafeThread`+- `allowThreads`, `runInGcSafeThread` - - Nix 2.15 support+- Nix 2.15 support - - Nix 2.16 support+- Nix 2.16 support -## 0.3.5.1 - 2023-03-06+## [0.3.5.1] - 2023-03-06 ### Added - - Nix 2.14 support+- Nix 2.14 support - - Nix 2.13 support+- Nix 2.13 support -## 0.3.5.0 - 2022-12-29+## [0.3.5.0] - 2022-12-29 ### Added - - `initThread` for stack overflow handling+- `initThread` for stack overflow handling -## 0.3.4.0 - 2022-11-15+## [0.3.4.0] - 2022-11-15 ### Added - - `::??`, `#??` for redundantly optional types: unset or null- - Schema module instances for `()` representing `null`- - `InvalidValue` constructor for `NixException`- - `.` and `?` type operators for field access and optional field access- - Schema module instances for `[a]` for Nix lists of `a`,- - Schema `Int64` (= `NixInt`) instance for Nix integers- - Schema `traverseArray` helper for traversing Nix lists (should have been renamed)+- `::??`, `#??` for redundantly optional types: unset or null+- Schema module instances for `()` representing `null`+- `InvalidValue` constructor for `NixException`+- `.` and `?` type operators for field access and optional field access+- Schema module instances for `[a]` for Nix lists of `a`,+- Schema `Int64` (= `NixInt`) instance for Nix integers+- Schema `traverseArray` helper for traversing Nix lists (should have been renamed) -## 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.2 - 2022-04-08+## [0.3.1.2] - 2022-04-08 ### Fixed - - `getFlakeFromGit` now handles branch names correctly+- `getFlakeFromGit` now handles branch names correctly -## 0.3.1.1 - 2022-03-21+## [0.3.1.1] - 2022-03-21 -### Fixed+### Removed - - Add test data that was missing from the sdist tarball+- Clean up inline-c generated exports -### Removed+### Fixed - - Clean up inline-c generated exports+- Add test data that was missing from the sdist tarball -## 0.3.1.0 - 2022-03-18+## [0.3.1.0] - 2022-03-18 ### Added - - `instance ToValue (PSObject t)`+- `instance ToValue (PSObject t)` -## 0.3.0.0 - 2022-03-15+## [0.3.0.0] - 2022-03-15 ### Added - - `ToValue` and `ToRawValue` classes for converting Haskell values+- `ToValue` and `ToRawValue` classes for converting Haskell values to Nix values. - - `Hercules.CNix.Expr.Schema` module for a typed interface between+- `Hercules.CNix.Expr.Schema` module for a typed interface between code in the Nix language and Haskell. This also includes provenance tracking, improving error messages while reducing error handling noise in the Haskell code. - - `addAllowedPath`, `addInternalAllowedPaths` for use with restricted mode.+- `addAllowedPath`, `addInternalAllowedPaths` for use with restricted mode. ### Changed - - Flakes are enabled during `init`+- Flakes are enabled during `init` ### Removed - - Nix 2.3 support+- Nix 2.3 support -## 0.2.0.2 - 2022-03-09+## [0.2.0.2] - 2022-03-09 ### Added - - Nix 2.7 support+- Nix 2.7 support -## 0.2.0.1 - 2022-03-07+## [0.2.0.1] - 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.0.0 - 2021-06-22+## [0.2.0.0] - 2021-06-22 ### Added - - nixUnstable compatibility with flag `nix-2_4`+- nixUnstable compatibility with flag `nix-2_4` -## 0.1.0.0 - 2021-03-07+## [0.1.0.0] - 2021-03-07 ### Added - - First code based on Hercules CI Agent.+- First code based on Hercules CI Agent.+++[0.5.1.0]: https://github.com/hercules-ci/hercules-ci-agent/commits/hercules-ci-cnix-expr-0.5.1.0/hercules-ci-cnix-expr+[0.5.0.0]: https://github.com/hercules-ci/hercules-ci-agent/commits/hercules-ci-cnix-expr-0.5.0.0/hercules-ci-cnix-expr+[0.4.0.0]: https://github.com/hercules-ci/hercules-ci-agent/commits/hercules-ci-cnix-expr-0.4.0.0/hercules-ci-cnix-expr+[0.3.6.5]: https://github.com/hercules-ci/hercules-ci-agent/commits/hercules-ci-cnix-expr-0.3.6.5/hercules-ci-cnix-expr+[0.3.6.4]: https://github.com/hercules-ci/hercules-ci-agent/commits/hercules-ci-cnix-expr-0.3.6.4/hercules-ci-cnix-expr+[0.3.6.3]: https://github.com/hercules-ci/hercules-ci-agent/commits/hercules-ci-cnix-expr-0.3.6.3/hercules-ci-cnix-expr+[0.3.6.2]: https://github.com/hercules-ci/hercules-ci-agent/commits/hercules-ci-cnix-expr-0.3.6.2/hercules-ci-cnix-expr+[0.3.6.1]: https://github.com/hercules-ci/hercules-ci-agent/commits/hercules-ci-cnix-expr-0.3.6.1/hercules-ci-cnix-expr+[0.3.6.0]: https://github.com/hercules-ci/hercules-ci-agent/commits/hercules-ci-cnix-expr-0.3.6.0/hercules-ci-cnix-expr+[0.3.5.1]: https://github.com/hercules-ci/hercules-ci-agent/commits/hercules-ci-cnix-expr-0.3.5.1/hercules-ci-cnix-expr+[0.3.5.0]: https://github.com/hercules-ci/hercules-ci-agent/commits/hercules-ci-cnix-expr-0.3.5.0/hercules-ci-cnix-expr+[0.3.4.0]: https://github.com/hercules-ci/hercules-ci-agent/commits/hercules-ci-cnix-expr-0.3.4.0/hercules-ci-cnix-expr+[0.3.3.0]: https://github.com/hercules-ci/hercules-ci-agent/commits/hercules-ci-cnix-expr-0.3.3.0/hercules-ci-cnix-expr+[0.3.2.0]: https://github.com/hercules-ci/hercules-ci-agent/commits/hercules-ci-cnix-expr-0.3.2.0/hercules-ci-cnix-expr+[0.3.1.2]: https://github.com/hercules-ci/hercules-ci-agent/commits/hercules-ci-cnix-expr-0.3.1.2/hercules-ci-cnix-expr+[0.3.1.1]: https://github.com/hercules-ci/hercules-ci-agent/commits/hercules-ci-cnix-expr-0.3.1.1/hercules-ci-cnix-expr+[0.3.1.0]: https://github.com/hercules-ci/hercules-ci-agent/commits/hercules-ci-cnix-expr-0.3.1.0/hercules-ci-cnix-expr+[0.3.0.0]: https://github.com/hercules-ci/hercules-ci-agent/commits/hercules-ci-cnix-expr-0.3.0.0/hercules-ci-cnix-expr+[0.2.0.2]: https://github.com/hercules-ci/hercules-ci-agent/commits/hercules-ci-cnix-expr-0.2.0.2/hercules-ci-cnix-expr+[0.2.0.1]: https://github.com/hercules-ci/hercules-ci-agent/commits/hercules-ci-cnix-expr-0.2.0.1/hercules-ci-cnix-expr+[0.2.0.0]: https://github.com/hercules-ci/hercules-ci-agent/commits/hercules-ci-cnix-expr-0.2.0.0/hercules-ci-cnix-expr+[0.1.0.0]: https://github.com/hercules-ci/hercules-ci-agent/commits/hercules-ci-cnix-expr-0.1.0.0/hercules-ci-cnix-expr+[Unreleased]: https://github.com/hercules-ci/hercules-ci-agent/commits/master/hercules-ci-cnix-expr
hercules-ci-cnix-expr.cabal view
@@ -1,7 +1,7 @@ cabal-version: 2.4 name: hercules-ci-cnix-expr-version: 0.5.1.0+version: 0.5.2.0 synopsis: Bindings for the Nix evaluator category: Nix, CI, Testing, DevOps homepage: https://docs.hercules-ci.com@@ -116,11 +116,11 @@ extra-libraries: boost_context pkgconfig-depends:- nix-store >= 2.28 && < 2.34- , nix-expr >= 2.28 && < 2.34+ nix-store >= 2.28 && < 2.36+ , nix-expr >= 2.28 && < 2.36 -- TODO: replace nix-main stack overflow detection?- , nix-main >= 2.28 && < 2.34- , nix-flake >= 2.28 && < 2.34+ , nix-main >= 2.28 && < 2.36+ , nix-flake >= 2.28 && < 2.36 test-suite hercules-ci-cnix-expr-unit-tests
src/Hercules/CNix/Expr.hs view
@@ -676,16 +676,36 @@ }|] >>= mkRawValue +-- | Fetch a flake from a tarball URL. getFlakeFromArchiveUrl :: Ptr EvalState -> Text -> IO RawValue-getFlakeFromArchiveUrl evalState url = do- srcArgs <-- toRawValue evalState $- ("url" :: ByteString) =: url- fn <- valueFromExpressionString evalState "builtins.fetchTarball" "/"- pValue <- apply fn srcArgs- p <- assertType evalState pValue- p' <- getStringIgnoreContext p- getFlakeFromFlakeRef evalState p'+getFlakeFromArchiveUrl evalState url =+ let urlb = encodeUtf8 url+ in [C.throwBlock| Value *{+ EvalState &evalState = *$(EvalState *evalState);+ Value *r = new (NoGC) Value();+ std::string url($bs-ptr:urlb, $bs-len:urlb);++ fetchers::Attrs attrs;+ attrs.emplace("type", "tarball");+ attrs.emplace("url", url);++ auto flakeRef = nix::FlakeRef::fromAttrs(+ fetchSettings,+ attrs);+ nix::flake::callFlake(evalState,+ nix::flake::lockFlake(+ flakeSettings,+ evalState,+ flakeRef,+ nix::flake::LockFlags {+ .updateLockFile = false,+ .useRegistries = false,+ .allowUnlocked = false,+ }),+ *r);+ return r;+ }|]+ >>= mkRawValue traverseWithKey_ :: (Applicative f) => (k -> a -> f ()) -> Map k a -> f () traverseWithKey_ f = M.foldrWithKey (\k a more -> f k a *> more) (pure ())