Commit graph

15134 commits

Author SHA1 Message Date
Yueh-Shun Li
6b47635180 Add helper function parseHashFormat[Opt] printHashFormat
Add hash format analogy of
parseHashTypeOpt, parseHashType, and printHashType.

Co-authored-by: Valentin Gagarin <valentin.gagarin@tweag.io>
2023-10-19 00:56:44 +08:00
Yueh-Shun Li
231b0fca6d Migrate HashFormat to scoped enumeration (enum struct) 2023-10-19 00:56:44 +08:00
Yueh-Shun Li
e026f3e1ae treewide: Reference HashFormat members with scope
Base* -> HashFormat::Base*
2023-10-19 00:56:41 +08:00
Yueh-Shun Li
5043e6cf4e Document HashFormat 2023-10-19 00:38:32 +08:00
Yueh-Shun Li
838c70f621 treewide: Rename hashBase to hashFormat
hashBase is ambiguous, since it's not about the digital bases, but about
the format of hashes. Base16, Base32 and Base64 are all character maps
for binary encoding.

Rename the enum Base to HashFormat.

Rename variables of type HashFormat from [hash]Base to hashFormat,
including CmdHashBase::hashFormat and CmdToBase::hashFormat.
2023-10-19 00:38:32 +08:00
Yueh-Shun Li
aff177d860 Elaborate the "unknown hash algorithm" error
List the allowed hash formats
2023-10-19 00:38:32 +08:00
Yueh-Shun Li
e9ddf0b400 Simplify parseHashTypeOpt
Remove redundant "else" after "return".

Use std::nullopt to increase readability.
2023-10-19 00:38:32 +08:00
Eelco Dolstra
201c115c3e
Merge pull request #9151 from edolstra/stabilize-fetchTree
Stabilize fetchTree
2023-10-18 10:54:08 +02:00
Théophane Hufschmitt
c1a1766c46
Merge pull request #9169 from vkryachko/follow_cycle
Detect cycles in flake follows.
2023-10-18 07:34:03 +02:00
John Ericson
9d1f42db52
Merge pull request #9150 from vicky1999/fix/8914
`nix store ping` -> `nix store info`
2023-10-17 22:52:28 -04:00
vicky1999
891dfb4359 updated store ping to store info in files 2023-10-18 00:14:11 +05:30
vicky1999
a0f071f1d3 store info sh renamed 2023-10-18 00:12:10 +05:30
Eelco Dolstra
3470cd68c4 Mark some fetchers as experimental 2023-10-17 14:57:29 +02:00
Eelco Dolstra
f62b5500ff fetchTree: Require the flakes experimental feature for the URL syntax 2023-10-17 14:52:34 +02:00
Eelco Dolstra
e92cac789f
Merge pull request #9168 from obsidiansystems/fix-lang-tests-read-only
Fix language tests a bit
2023-10-17 14:45:38 +02:00
Eelco Dolstra
a9b8595fd9
Merge pull request #9162 from eclairevoyant/add-mainprogram
explicitly set meta.mainProgram
2023-10-17 14:44:29 +02:00
vicky1999
dcc5f801f4 Store info command help updates 2023-10-17 09:39:59 +05:30
John Ericson
8c049a9f04
Merge pull request #9172 from tfc/bad-moves
Fix/remove some bad std::moves
2023-10-16 17:46:41 -04:00
Jacek Galowicz
54b350d517 Drop some moves that would happen anyway but forbid NRVO where appicable 2023-10-16 21:48:35 +01:00
Jacek Galowicz
abf7df2b37 Fix moves that accidentally copy anyway 2023-10-16 21:48:35 +01:00
Vladimir Kryachko
d6066c90f8 Don't convert InputPaths to strings prematurely. 2023-10-16 15:47:28 -04:00
John Ericson
aa4f41d796
Merge pull request #9170 from tfc/fix-broken-move
Fix broken move
2023-10-16 15:13:03 -04:00
Jacek Galowicz
add066cc7b Fix broken move 2023-10-16 19:32:47 +01:00
Vladimir Kryachko
b3fd7db63f Detect cycles in flake follows.
This change results in an error thrown as opposed to segfaulting due to
stack overflow.

Fixes #9144
2023-10-16 13:00:49 -04:00
John Ericson
f7a36f9812 Fix language tests a bit
- Remove some stray saved error messages that didn't correspond to any
  test, because they were renamed in
  d11faa01b5.

- Need `--eval` in test failure test in order to get in "read-only" mode
  where we don't try to write to the store. (The other tests already do
  this.)

- Need `--strict` so top-level attribute sets are still forced, like
  they are without `--eval`.
2023-10-16 12:52:59 -04:00
John Ericson
5442d9b472
Merge pull request #9167 from obsidiansystems/pre-overhaul-completions
Improve tests and docs prior to refactoring completions
2023-10-16 12:12:28 -04:00
John Ericson
483d99c622 Add API docs to some args-related functionality 2023-10-16 11:25:15 -04:00
John Ericson
c27d2f8da9 Add two more completions tests
Thanks @ncfavier for catching these regressions in my PR.

Co-Authored-By: Naïm Favier <n@monade.li>
2023-10-16 10:09:10 -04:00
John Ericson
d12c614ac7
Merge pull request #9152 from obsidiansystems/split-out-perl-nix
Factor out Perl bindings Nix package
2023-10-16 09:57:37 -04:00
Eelco Dolstra
6bf68c1e64
Merge pull request #8904 from wentasah/metadata-shows-last-modified
nix flakes metadata: Show lastModified timestamp for each input
2023-10-16 13:52:51 +02:00
éclairevoyant
e5ce53f3db
explicitly set meta.mainProgram 2023-10-15 15:08:07 -04:00
John Ericson
a23cc147cb Factor out Perl bindings Nix package
Progress breaking up `flake.nix` by introducing separate `default.nix`
files which make sense on their own. (This one is a regular
`callPackage`-able package.)
2023-10-13 11:04:51 -04:00
John Ericson
d070d8b746
Merge pull request #9137 from obsidiansystems/serve-protocol
Introduce separate Serve protocol serialisers
2023-10-13 10:51:46 -04:00
Eelco Dolstra
4112dd1fc9 Mark fetchTree as stable 2023-10-13 16:45:08 +02:00
Robert Hensing
da2b59a088
Merge pull request #8047 from lovesegfault/always-allow-substitutes
feat: add always-allow-substitutes
2023-10-13 15:42:11 +02:00
Eelco Dolstra
2084312313
Merge pull request #9061 from edolstra/stabilize-fetchTree
fetchTree cleanup
2023-10-13 15:11:14 +02:00
Eelco Dolstra
8eb4f735dc fetchTree: Only use the registry if flakes are enabled 2023-10-13 14:34:32 +02:00
Eelco Dolstra
4ce7a53a9c Update fetchTree docs 2023-10-13 14:34:32 +02:00
Eelco Dolstra
856fe13533 fetchTree cleanup
Two changes:

* The (probably unintentional) hack to handle paths as tarballs has
  been removed. This is almost certainly not what users expect and is
  inconsistent with flakeref handling everywhere else.

* The hack to support scp-style Git URLs has been moved to the Git
  fetcher, so it's now supported not just by fetchTree but by flake
  inputs.
2023-10-13 14:34:23 +02:00
Michal Sojka
db0d94560b Document builtins.fetchTree
Co-authored-by: Valentin Gagarin <valentin.gagarin@tweag.io>

Supersedes #6740
2023-10-13 14:24:10 +02:00
vicky1999
5c65379b22 info store alias added to store-ping 2023-10-13 07:16:05 +05:30
vicky1999
b4b1a07f97 store info alias created 2023-10-13 06:48:35 +05:30
Ninlives
94e91566ed
Allow CLI to pass environment variables to FOD builder (#8830)
Add a new experimental `impure-env` setting that is a key-value list of
environment variables to inject into FOD derivations that specify the
corresponding `impureEnvVars`.

This allows clients to make use of this feature (without having to change the
environment of the daemon itself) and might eventually deprecate the current
behaviour (pick whatever is in the environment of the daemon) as it's more
principled and might prevent information leakage.
2023-10-11 11:58:42 +00:00
Valentin Gagarin
301623f3a3
Merge pull request #9134 from fricklerhandwerk/syntax-admonitions 2023-10-10 18:02:52 +02:00
John Ericson
f7b8f8aff6 Introduce separate Serve protocol serialisers
To start, it is just a clone of the common protocol. But now that we
have the separate protocol implementations, we can add versioning
information without the versions of one protocol leaking into another.

Using the infrastructure from the previous commit, we don't have to
duplicate code for shared behavior.

Motivation: No more perverse incentives. [0] did some awkward things
because the serialisers did not store the version. I don't want anyone
making changes to be pushed towards keeping the serialization logic with
the core data types just because it's easier or the alternative is
tedious.

The actual versioning of the Worker and Serve protocol serialisers
(Common remains unversioned as the underlying mini-protocols are not
versioned) will happen in subsequent commits / PRs.

[0]: fe1f34fa60
2023-10-10 11:52:45 -04:00
John Ericson
c7f1d86b80
Merge pull request #9115 from fricklerhandwerk/lookup-algorithm
reword documentation on lookup path resolution
2023-10-10 10:44:32 -04:00
Valentin Gagarin
7642894a4e reword documentation on lookup path resolution 2023-10-10 00:49:27 +02:00
Valentin Gagarin
1e1f08c045 annotate admonitions showing syntax
also fix typos
2023-10-10 00:45:19 +02:00
John Ericson
4b1a97338f
Merge pull request #9099 from obsidiansystems/common-proto
Factor out bits of the worker protocol to use elsewhere
2023-10-09 17:31:54 -04:00
John Ericson
4de54b2190 Unit test the "common protocol" too
Copy the relevant tests to ensure the new interfaces added in the last
commit are tested.

Perhaps I should try to deduplicat these tests some more. However its
not clear how to do that outside of a big ugly C++ macro.
https://github.com/google/googletest/blob/main/docs/advanced.md has some
stuff but it is cumbersome and I didn't figure it out yet.

This is done in a separate commit in order to be sure that the first
commit really didn't change any behavior; if we changed the
implementation and the tests at once, it would be harder to tell whether
or not some behavioral changes slipped in what is supposed to be a "pure
refactor".

Co-Authored-By: Valentin Gagarin <valentin.gagarin@tweag.io>
2023-10-09 16:57:03 -04:00