Commit graph

96 commits

Author SHA1 Message Date
Robert Hensing
eb0595226d doc: Context
(cherry picked from commit 976ecda38530d57b872c20eaeab5d3631076140b)
2025-10-04 02:31:16 +02:00
Robert Hensing
01c9d0b2d3 feat: EvalState.weak_ref()
(cherry picked from commit d7a72c82ebfbfbb1b58fa15044b63648b2109260)
2025-10-04 02:31:16 +02:00
Robert Hensing
e0dead151e feat: Store.weak_ref()
(cherry picked from commit 2fdcc5df62a6cea790bea9b867e1b6d044d4a28f)
2025-10-04 02:31:16 +02:00
Robert Hensing
3d5c64c4a6 feat: impl Clone for EvalState
(cherry picked from commit f22d9ba23564107480f627a5901a52f044034c98)
2025-10-04 02:31:16 +02:00
Robert Hensing
03f6c63373 feat: impl Clone for Store
(cherry picked from commit 90750c3c82ab0a5973de634661c5284c74fc89a8)
2025-10-04 02:31:16 +02:00
Robert Hensing
9cebf1d131 feat: Value::new_borrowed
(cherry picked from commit 86e3828250d4de15f9cf49d19222eb382c77f7e2)
2025-10-04 02:31:16 +02:00
Robert Hensing
590a748e82 maint: Update nixpkgs
was:
feat: Empty manual

(cherry picked from commit a7de1171105d4609b500e69d42fa1ade5cd6f1f1)
2025-10-04 02:31:16 +02:00
Robert Hensing
bd8ebcbb01 dev: Add hercules-ci-effects dev input
(cherry picked from commit 85f10d0410a061f151722042924afc8523869aa7)
2025-10-04 02:31:16 +02:00
Robert Hensing
7918175c24 refact: Move dev-only dependencies into separate lock file
(cherry picked from commit ddf306bb9564a43fb42ab4321b390e766254f1c4)
2025-10-04 02:31:16 +02:00
Robert Hensing
271cf09450 flake.lock: Update
Flake lock file updates:

• Updated input 'flake-parts':
    'github:hercules-ci/flake-parts/8471fe90ad337a8074e957b69ca4d0089218391d?narHash=sha256-XOQkdLafnb/p9ij77byFQjDf5m5QYl9b2REiVClC%2Bx4%3D' (2024-08-01)
  → 'github:hercules-ci/flake-parts/af510d4a62d071ea13925ce41c95e3dec816c01d?narHash=sha256-ODYRm8zHfLTH3soTFWE452ydPYz2iTvr9T8ftDMUQ3E%3D' (2024-08-30)
• Updated input 'flake-parts/nixpkgs-lib':
    'https://github.com/NixOS/nixpkgs/archive/a5d394176e64ab29c852d03346c1fc9b0b7d33eb.tar.gz?narHash=sha256-uFf2QeW7eAHlYXuDktm9c25OxOyCoUOQmh5SZ9amE5Q%3D' (2024-08-23)
  → 'https://github.com/NixOS/nixpkgs/archive/a5d394176e64ab29c852d03346c1fc9b0b7d33eb.tar.gz?narHash=sha256-uFf2QeW7eAHlYXuDktm9c25OxOyCoUOQmh5SZ9amE5Q%3D' (2024-08-01)

(cherry picked from commit 07998ef498cabbfd3c18b223da0f38f3d82a7e9a)
2025-10-04 02:31:16 +02:00
Robert Hensing
ee1d591e1a fix: Update for more recent Nix API
(cherry picked from commit 55355f03ab86dfa15972681d9a51d333739f6d10)
2025-10-04 02:31:16 +02:00
Robert Hensing
cf6bedde14 flake.nix: Unfollow nixpkgs in flake-parts
This may speed up autocompletion since the default lib is a small
path.

(It shouldn't matter, but Nix isn't as lazy as it will be yet, so
here we go.)

(cherry picked from commit 90709ff3c690275dfb6b8fce50cb0282a52e1971)
2025-10-04 02:31:16 +02:00
Robert Hensing
1ed50f009a flake.lock: Update
Flake lock file updates:

• Updated input 'flake-parts':
    'github:hercules-ci/flake-parts/b253292d9c0a5ead9bc98c4e9a26c6312e27d69f?narHash=sha256-a0NYyp%2Bh9hlb7ddVz4LUn1vT/PLwqfrWYcHMvFB1xYg%3D' (2024-02-01)
  → 'github:hercules-ci/flake-parts/8471fe90ad337a8074e957b69ca4d0089218391d?narHash=sha256-XOQkdLafnb/p9ij77byFQjDf5m5QYl9b2REiVClC%2Bx4%3D' (2024-08-01)
• Updated input 'nix-cargo-integration':
    'github:yusdacra/nix-cargo-integration/eddee765f67966646c487f554fc843e8513aad28?narHash=sha256-VixqzHPc4VGd3TVcdTSufrpZ6wequ0a8BGSQOuxaFps%3D' (2024-02-08)
  → 'github:yusdacra/nix-cargo-integration/3a8e3bb661db28522aa2d4a55f1fccf9f95ec33e?narHash=sha256-fjwO6Pv3d35F6UErY42hc7zXJr6ek0LhSZlgEu%2BeI04%3D' (2024-08-23)
• Updated input 'nix-cargo-integration/dream2nix':
    'github:nix-community/dream2nix/936208ae7d88a178a0bcf7e6ac21bb6b87f6c8ea?narHash=sha256-tDmoPA3gukJPfjR/pKl6hNcRP7cuEGw6ruoguHS4szo%3D' (2024-02-06)
  → 'github:nix-community/dream2nix/3fd4c14d3683baac8d1f94286ae14fe160888b51?narHash=sha256-fFS8aDnfK9Qfm2FLnQ8pqWk8FzvFEv5LvTuZTZLREnc%3D' (2024-08-01)
• Updated input 'nix-cargo-integration/parts':
    'github:hercules-ci/flake-parts/b253292d9c0a5ead9bc98c4e9a26c6312e27d69f?narHash=sha256-a0NYyp%2Bh9hlb7ddVz4LUn1vT/PLwqfrWYcHMvFB1xYg%3D' (2024-02-01)
  → 'github:hercules-ci/flake-parts/8471fe90ad337a8074e957b69ca4d0089218391d?narHash=sha256-XOQkdLafnb/p9ij77byFQjDf5m5QYl9b2REiVClC%2Bx4%3D' (2024-08-01)
• Updated input 'nix-cargo-integration/rust-overlay':
    'github:oxalica/rust-overlay/dd917bb1b67fc049fd56fe6de70266a9ab74a4aa?narHash=sha256-Nuhi8KEJ2e%2B2nTimSyEIPqN5eh7ECVWd%2BAnPXG6L%2BSY%3D' (2024-02-08)
  → 'github:oxalica/rust-overlay/a18034322c7703fcfe5d7352a77981ba4a936a61?narHash=sha256-%2BCFDh1FUgyY7q0FiWhKJpHS7LlD3KbiqN5Z4Z%2B4bGmc%3D' (2024-08-23)
• Updated input 'nix-cargo-integration/treefmt':
    'github:numtide/treefmt-nix/ac599dab59a66304eb511af07b3883114f061b9d?narHash=sha256-qQF0fEkHlnxHcrKIMRzOETnRBksUK048MXkX0SOmxvA%3D' (2024-02-07)
  → 'github:numtide/treefmt-nix/070f834771efa715f3e74cd8ab93ecc96fabc951?narHash=sha256-kKJtaiU5Ou%2Be/0Qs7SICXF22DLx4V/WhG1P6%2Bk4yeOE%3D' (2024-08-22)
• Updated input 'pre-commit-hooks-nix':
    'github:cachix/pre-commit-hooks.nix/e611897ddfdde3ed3eaac4758635d7177ff78673?narHash=sha256-6hOpUiuxuwpXXc/xfJsBUJeqqgGI%2BJMJuLo45aG3cKc%3D' (2024-03-20)
  → 'github:cachix/pre-commit-hooks.nix/6cedaa7c1b4f82a266e5d30f212273e60d62cb0d?narHash=sha256-TuSaYdhOxeaaE9885mFO1lZHHax33GD5A9dczJrGUjw%3D' (2024-08-21)
• Removed input 'pre-commit-hooks-nix/flake-utils'
• Removed input 'pre-commit-hooks-nix/flake-utils/systems'
• Updated input 'pre-commit-hooks-nix/gitignore':
    'github:hercules-ci/gitignore.nix/43e1aa1308018f37118e34d3a9cb4f5e75dc11d5?narHash=sha256-gGPa9qWNc6eCXT/%2BZ5/zMkyYOuRZqeFZBDbopNZQkuY%3D' (2023-12-29)
  → 'github:hercules-ci/gitignore.nix/637db329424fd7e46cf4185293b9cc8c88c95394?narHash=sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs%3D' (2024-02-28)
• Updated input 'pre-commit-hooks-nix/nixpkgs-stable':
    'github:NixOS/nixpkgs/3dc440faeee9e889fe2d1b4d25ad0f430d449356?narHash=sha256-YWuCrtsty5vVZvu%2B7BchAxmcYzTMfolSPP5io8%2BWYCg%3D' (2024-01-10)
  → 'github:NixOS/nixpkgs/194846768975b7ad2c4988bdb82572c00222c0d7?narHash=sha256-NGKVY4PjzwAa4upkGtAMz1npHGoRzWotlSnVlqI40mo%3D' (2024-07-07)

(cherry picked from commit 9621053e6c5af58af8ba5cc9ead42fe987f298b0)
2025-10-04 02:31:16 +02:00
Robert Hensing
6b98acb382 flake.lock: Update
Flake lock file updates:

• Updated input 'nix':
    'github:NixOS/nix/c90a763273f94ec5e82f21bfb2b359d04af86383?narHash=sha256-Lsd3e8xDtAfo/RgpzYgi1P2Wkp1DqTP3n8TI1BK1JPY%3D' (2024-05-24)
  → 'github:NixOS/nix/85f1aa6b3df5c5fcc924a74e2a9cc8acea9ba0e1?narHash=sha256-3%2BUgAktTtkGUNpxMxr%2Bq%2BR%2Bz3r026L3PwJzG6RD2IXM%3D' (2024-08-23)
• Updated input 'nix/flake-compat':
    'github:edolstra/flake-compat/35bb57c0c8d8b62bbfd284272c928ceb64ddbde9?narHash=sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm%2B504Ch3sNKLd8%3D' (2023-01-17)
  → 'github:edolstra/flake-compat/0f9255e01c2351cc7d116c072cb317785dd33b33?narHash=sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U%3D' (2023-10-04)
• Updated input 'nix/flake-parts':
    'github:hercules-ci/flake-parts/9126214d0a59633752a136528f5f3b9aa8565b7d?narHash=sha256-sB4SWl2lX95bExY2gMFG5HIzvva5AVMJd4Igm%2BGpZNw%3D' (2024-04-01)
  → 'github:hercules-ci/flake-parts/9227223f6d922fee3c7b190b2cc238a99527bbb7?narHash=sha256-pQMhCCHyQGRzdfAkdJ4cIWiw%2BJNuWsTX7f0ZYSyz0VY%3D' (2024-07-03)
• Added input 'nix/git-hooks-nix':
    'github:cachix/git-hooks.nix/f451c19376071a90d8c58ab1a953c6e9840527fd?narHash=sha256-6FPUl7HVtvRHCCBQne7Ylp4p%2BdpP3P/OYuzjztZ4s70%3D' (2024-07-15)
• Added input 'nix/git-hooks-nix/flake-compat':
    follows 'nix'
• Added input 'nix/git-hooks-nix/gitignore':
    follows 'nix'
• Added input 'nix/git-hooks-nix/nixpkgs':
    follows 'nix/nixpkgs'
• Added input 'nix/git-hooks-nix/nixpkgs-stable':
    follows 'nix/nixpkgs'
• Updated input 'nix/libgit2':
    'github:libgit2/libgit2/45fd9ed7ae1a9b74b957ef4f337bc3c8b3df01b5?narHash=sha256-oX4Z3S9WtJlwvj0uH9HlYcWv%2Bx1hqp8mhXl7HsLu2f0%3D' (2023-10-18)
  → 'github:libgit2/libgit2/36f7e21ad757a3dacc58cf7944329da6bc1d6e96?narHash=sha256-J2rCxTecyLbbDdsyBWn9w7r3pbKRMkI9E7RvRgAqBdY%3D' (2024-05-16)
• Added input 'nix/nixpkgs-23-11':
    'github:NixOS/nixpkgs/a62e6edd6d5e1fa0329b8653c801147986f8d446?narHash=sha256-oamiKNfr2MS6yH64rUn99mIZjc45nGJlj9eGth/3Xuw%3D' (2024-05-31)
• Removed input 'nix/pre-commit-hooks'
• Removed input 'nix/pre-commit-hooks/flake-compat'
• Removed input 'nix/pre-commit-hooks/flake-utils'
• Removed input 'nix/pre-commit-hooks/flake-utils/systems'
• Removed input 'nix/pre-commit-hooks/gitignore'
• Removed input 'nix/pre-commit-hooks/nixpkgs'
• Removed input 'nix/pre-commit-hooks/nixpkgs-stable'
• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/faf912b086576fd1a15fca610166c98d47bc667e?narHash=sha256-ZbHsm%2BmGk/izkWtT4xwwqz38fdlwu7nUUKXTOmm4SyE%3D' (2024-02-05)
  → 'github:NixOS/nixpkgs/c374d94f1536013ca8e92341b540eba4c22f9c62?narHash=sha256-Z/ELQhrSd7bMzTO8r7NZgi9g5emh%2BaRKoCdaAv5fiO0%3D' (2024-08-21)

(cherry picked from commit 76b1b22ca32d1540ee300836e632d5e4fa1f82ad)
2025-10-04 02:31:16 +02:00
Taeer Bar-Yam
c235b32868 check_call_opt_key: [] -> ()
(cherry picked from commit 76966c24dcf6413a4ebdfe0ddba00e3d1d7e5fff)
2025-10-04 02:31:16 +02:00
Taeer Bar-Yam
cc2e640e7f check_call!() macro to use () not []
(cherry picked from commit 66d255af0a5d331782dc24c89bb45d3434f3c109)
2025-10-04 02:31:16 +02:00
Robert Hensing
da26721bea fix: Do not duplicate ctx expr in check_call_opt_key!
(cherry picked from commit 86ddc63a573cd08ec19008448ec2fca33a84159e)
2025-10-04 02:31:16 +02:00
Robert Hensing
35803f4a30 refactor: Remove check_one_call
(cherry picked from commit 065f880e52c6d6cb44e4b857272176ebe2464eea)
2025-10-04 02:31:16 +02:00
Robert Hensing
bf6dbd3f1e fix: Do not duplicate ctx expr in check_call!
(cherry picked from commit 9b6f0c1e66d80ec2e92ce079152edb22c05e9b1e)
2025-10-04 02:31:16 +02:00
Robert Hensing
870c03ee4d fix: Revert hiding of Context::ptr, add check_call_opt_key
(cherry picked from commit 5fba79143c85177d1649aa97d70ece067bade0fd)
2025-10-04 02:31:16 +02:00
Robert Hensing
a6dbf17778 fix: Require mutable Context, as it should be
This spreads out transitively to many places and requires that
we use `check_call!` instead of `check_one_call` in a number of
places.

(cherry picked from commit 6bc31dcf206518a7be7f0ac6e773d5dfe25531ea)
2025-10-04 02:31:16 +02:00
Taeer Bar-Yam
226639939f feat: nix_util::context::check_call!(func[...])
> I couldn't figure out a way to use () for the function call, but I didn't try that hard.

I (Robert) have also given it a shot, briefly, unsuccessfully.

While I was critical of over-engineering this, it turns out that
when we start to use `mut`, a macro is much more practical, because
it doesn't create a new scope where we need a copy of a mutable
reference, which of course is not allowed.

(cherry picked from commit a2acc93d13991da4b14a99065acd589477334d07)
2025-10-04 02:31:16 +02:00
Robert Hensing
2f3a5fb039 refact: Clean up Context interface to be safer
The mutation-based methods had some pitfalls, and we don't really
need them.

We could re-add them if we need to.

(cherry picked from commit ca92b8491d87cebf54dd2468599168fc7a16c07f)
2025-10-04 02:31:16 +02:00
Robert Hensing
93a2db836a doc: Clarify why we test call and apply and how they relate
(cherry picked from commit 17c7a8d30d1c4d99eeb84a6203ae33d2ba781edb)
2025-10-04 02:31:16 +02:00
Robert Hensing
b04d429f19 test: Make sure require_* functions force thunks
(cherry picked from commit 69b661db22e4b16fb08d322f5fede480438e2b71)
2025-10-04 02:31:16 +02:00
Robert Hensing
878b793161 test: eval_state_require_int_forces_thunk
(cherry picked from commit 90de70936a726a8ae1aaf3e9aacb9a83b8d30b72)
2025-10-04 02:31:16 +02:00
Robert Hensing
c16a9b0595 refact: Make require_attrs_select* error handling regular
(cherry picked from commit de6c6cbd462202405bc787fed02dee249cf16973)
2025-10-04 02:31:16 +02:00
Robert Hensing
61efb9b79f refact: Add Context::check_one_call(f)
This makes it easier to stick to a regular pattern and not forget
to check the context afterwards.

(cherry picked from commit 966ef3769a23075f5d660a48cf5a7307df925dbf)
2025-10-04 02:31:16 +02:00
Robert Hensing
c775792b63 fix: Do not unwrap() in require_int
(cherry picked from commit c7d2e3e02a977424634ee12015265906e18039a0)
2025-10-04 02:31:16 +02:00
Robert Hensing
22ffd20c53 refact: Use Option instead of custom ValueTypeOrThunk
This loses the custom name for "thunk", but checking thunkness is
a niche use case that I don't think we should spend much code on.

(cherry picked from commit 7bdff525c13234ce6a32ea9346292d948b0840c1)
2025-10-04 02:31:16 +02:00
Philipp
19361acb12 rename value_type_forced to value_type
Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
(cherry picked from commit 3bf206a38e20109bbee9cd781e66bcd895ed95ce)
2025-10-04 02:31:16 +02:00
Philipp Zander
627b31d6c5 refact: adjust ValueType use sites
(cherry picked from commit 9d9f7d59c6df3db26f331e63c9b210f8fae19061)
2025-10-04 02:31:16 +02:00
Philipp Zander
673f80e243 refact: remove Thunk from ValueType and introduce ValueTypeOrThunk to address #30
(cherry picked from commit 97c05175b633b364686790549b11e43cfb2f1d2c)
2025-10-04 02:31:16 +02:00
Philipp Zander
d89fb1803f doc: EvalState::eval_from_string
(cherry picked from commit b1de918abddc8166973c956ec77d597dae92f928)
2025-10-04 02:31:16 +02:00
Philipp Zander
fe4d62d083 test nix_store_open's params argument
(cherry picked from commit 2cebb64daacdc612e7ff916dc32b0fe5ed89dbfc)
2025-10-04 02:31:16 +02:00
Philipp Zander
ec28176852 adjust all tests to nix_store_open's new signature
(cherry picked from commit da9bf071709bc9e48a0a02531e78b2a71a9b4eba)
2025-10-04 02:31:16 +02:00
Philipp Zander
de09abb084 support nix_store_open's params argument
(cherry picked from commit 3dd5137e33709559ffa152feb7ab508246adfb54)
2025-10-04 02:31:16 +02:00
Robert Hensing
65451efd4b dev: Improve comment check file name regex
Co-authored-by: Taeer Bar-Yam <Radvendii@users.noreply.github.com>
(cherry picked from commit b401e52eba931374b782d83360411b197a8d59da)
2025-10-04 02:31:16 +02:00
Robert Hensing
6b438e5398 dev: Check that we use ///-style doc comments in Rust
(cherry picked from commit 395a4d7a46e8489ca98667fca3db8aebf998a9b6)
2025-10-04 02:31:16 +02:00
Robert Hensing
37da6411d0 maint: Use /// for doc comments
(cherry picked from commit 4a390197f71653dda99696ed5c9cbca8c6a95a4b)
2025-10-04 02:31:16 +02:00
Philipp Zander
ffdbf49ec5 test: Add assertion in eval_state::tests::eval_state_apply
(cherry picked from commit f8ff14274b6f7accf987328928186b25f842071f)
2025-10-04 02:31:16 +02:00
Robert Hensing
78435d4ed7 feat: EvalState::new_value_apply
(cherry picked from commit f8143ae4ed7b62b86cb232f8d73e53bae30d632c)
2025-10-04 02:31:16 +02:00
Robert Hensing
8fcc645c5d maint: Update nix to master
(cherry picked from commit 941dfa89024bde628dc1add30442d1d122a82ffb)
2025-10-04 02:30:46 +02:00
Robert Hensing
1ac0f10f74 refact: Fix warning
(cherry picked from commit e9371a0838eec93a0158a408c58be1a1efd44ab2)
2025-10-04 02:30:46 +02:00
Philipp Zander
9a62664fb1 test nix_state_create's lookupPath argument
(cherry picked from commit 6e5a259f60725b632e52d4839e6e3c285d6971d4)
2025-10-04 02:30:46 +02:00
Philipp Zander
d817e86c59 feat: support nix_state_create's lookupPath argument
(cherry picked from commit 6d0906688ea40760217c2e017a4a0a61eb0fd611)
2025-10-04 02:30:46 +02:00
Robert Hensing
726e891be8 feat: eval_state::test_init
(cherry picked from commit 040982222c9eb8ea91d7174e6f2e21bbc6cda8a4)
2025-10-04 02:30:46 +02:00
Robert Hensing
4095bda02a feat: EvalState.require_attrs_select{,_opt}
(cherry picked from commit cbba454aba1a90bb862d49925edd13820b6ace1b)
2025-10-04 02:30:46 +02:00
Robert Hensing
65f411d35e maint: Move conditionally unused use
(cherry picked from commit 21e3f3f569758b6cbf668c27330675c579efff5c)
2025-10-04 02:30:46 +02:00
Robert Hensing
d38cf51c63 feat: Context.is_key_error
(cherry picked from commit f754e243852103164dbc6fdaf8c0cccb3c85cfb1)
2025-10-04 02:30:46 +02:00