Commit graph

15099 commits

Author SHA1 Message Date
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
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
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
John Ericson be81764320 Factor out bits of the worker protocol to use elsewhere
This introduces some shared infrastructure for our notion of protocols.
We can then define multiple protocols in terms of that notion.
We an also express how particular protocols depend on each other.

For example, we can define a common protocol and a worker protocol,
where the second depends on the first in terms of the data types it can
read and write.

The "serve" protocol can just use the common one for now, but will
eventually need its own machinary just like the worker protocol for
version-aware serialisers
2023-10-09 16:55:12 -04:00
Valentin Gagarin aaef47a08e
Merge pull request #9131 from obsidiansystems/delete-bootstrap-script
Get rid of `bootstrap.sh`
2023-10-09 21:20:29 +02:00
John Ericson 2f0b508c29 Get rid of bootstrap.sh
For people working on Nix with `nix develop`, it's better to just use
`autoreconfPhase` and `configurePhase`, which is standard Nixpkgs / nix
shell make from Nixpkgs practice --- it is good to emphasize the degree
to which Nix is *just* a regular C++ project which can be worked on in
the regular way.

(For people running `nix-shell`, the story is similar, except
`configurePhase` would use non-writable store paths, which matters for
hte times we use output paths before `make install`, so I kept the
existing `./configure ...` instruction.)

For people building Nix without Nix (e.g. packaging it for another
distro) they also don't need `bootstrap.sh`, and can just run
`autoreconf -vfi` directly. (More likely, they have their own idioms to
do this just as we have `autoreconfPhase`.)
2023-10-09 12:55:58 -04:00
John Ericson 22513c91dc
Merge pull request #8942 from fricklerhandwerk/option-anchors
always show anchors on setting listings
2023-10-09 11:29:36 -04:00
John Ericson 838be5e4a0
Merge pull request #9114 from fricklerhandwerk/lookup-path
introduce lookup paths as a distinct language construct
2023-10-09 11:28:40 -04:00
Robert Hensing aeea49609b
Merge pull request #8895 from hercules-ci/gc-before-stats
eval: Run a full GC before printing stats
2023-10-09 17:14:45 +02:00
John Ericson 3953901796
Merge pull request #9112 from fricklerhandwerk/restrict-eval-nix-path
describe the effect of `restrict-eval` in a more focused manner
2023-10-09 11:07:21 -04:00
John Ericson a7a9386c96
Merge pull request #9111 from fricklerhandwerk/impure-constants
document that pure-eval also disables `builtins.nixPath`
2023-10-09 11:04:47 -04:00
John Ericson ead65d3d8e
Merge pull request #9110 from fricklerhandwerk/interpolated-expression
expand on interpolated expressions
2023-10-09 10:56:19 -04:00
Eelco Dolstra c8eb3b82e9
Merge pull request #9129 from fricklerhandwerk/ae-be
AE -> BE; fix redirects
2023-10-09 16:56:07 +02:00
John Ericson 217d863f7a Merge branch 'master' into lookup-path 2023-10-09 10:54:54 -04:00
Robert Hensing c32084a12c printStats -> maybePrintStats 2023-10-09 16:34:35 +02:00
John Ericson 67eddc05ef
Merge pull request #9116 from fricklerhandwerk/doc-import
reword and reformat description of `builtins.import`
2023-10-09 10:26:41 -04:00
John Ericson 81d3a8542a
doc: Slight reword of "interpolated expression" in paragraph
I was sleepy and confused that "interpolated expression" was a new type of thing at first. This nudges the reader to understand that its just a regular expression, and these conditions are imposed by the interpolation operation.
2023-10-09 10:21:18 -04:00
Robert Hensing 6b6bd90030
Merge pull request #9106 from Ericson2314/positive-source-filtering
Use positive source filtering for the standalone functional tests job and Perl bindings
2023-10-09 16:14:26 +02:00
John Ericson 3015375197
Merge pull request #9126 from fricklerhandwerk/dedent
remove unnecessary indentation from markdown list
2023-10-09 09:11:04 -04:00
John Ericson 6654b4e3b4 Use positive source filtering for the Perl bindings 2023-10-09 08:29:45 -04:00
John Ericson 47b3508665 Use positive source filtering for the standalone functional tests job
Additionally this skipping of the building is reimplemented to be a bit
more robust and use the same idioms as the functionality for skipping
the tests. In particular, it will now work even if the source files
exist, so we can do this during development too.
2023-10-09 08:29:27 -04:00
Valentin Gagarin 0246de1896 remove unnecessary indentation from markdown list
this makes it a bit easier to work with, as some tooling doesn't work
well with too much indentation.
2023-10-09 10:14:29 +02:00
Valentin Gagarin 896a905202 AE -> BE; fix redirects 2023-10-09 10:07:46 +02:00
Robert Hensing c29b8ba142
Merge pull request #9105 from Ericson2314/split-out-nixos-tests
Define NixOS tests in `tests/nixos/default.nix` rather than `flake.nix`
2023-10-07 11:30:22 +02:00
Valentin Gagarin f00a5eb11b introduce lookup paths as a distinct language construct
so far they did not really have a name, and were at best referred to as
"angle bracket syntax".
2023-10-07 04:44:09 +02:00
Valentin Gagarin 6305801626 reword and reformat description of builtins.import 2023-10-07 03:57:08 +02:00
Valentin Gagarin 2fe1ccf797 describe the effect of restrict-eval in a more focused manner 2023-10-07 03:20:20 +02:00
Valentin Gagarin a86a3e5e59 document that pure-eval also disables builtins.nixPath 2023-10-07 03:12:25 +02:00
Valentin Gagarin a7ba8c3f4a complete example on attribute name interpolation 2023-10-07 02:49:55 +02:00
Valentin Gagarin a67cee965a expand on interpolated expressions 2023-10-07 02:49:55 +02:00
Valentin Gagarin c167ffe1cf
Merge pull request #9108 from fricklerhandwerk/fix-redirect
remove duplicate redirects entry
2023-10-07 00:06:33 +02:00
Valentin Gagarin 517c547dec remove duplicate redirects entry 2023-10-06 23:34:08 +02:00
John Ericson 644ebaab5f Define NixOS tests in tests/nixos/default.nix rather than flake.nix
I think the our `flake.nix` is currently too large and too scary looking.
I think this matters --- if Nix cannot dog-food itself in a way that is
elegant, why should other people have confidence that their own code can
be elegant and easy to maintain?

We could do this at many points in time, but I think around now, when we
are thinking about stabilizing parts of Flakes, is an especially good
time.

This is a first step to make the `flake.nix` smaller, and make
individual components responsible for their own packaging. I hope we can
do this many more follow-ups like it, until the top-level `flake.nix` is
very small and just coordinates between other things.
2023-10-06 10:58:17 -04:00
John Ericson 61720d0035
Merge pull request #9103 from obsidiansystems/functional-tests-dir
Put functional tests in `tests/functional`
2023-10-06 09:34:11 -04:00
John Ericson 68c81c7375 Put functional tests in tests/functional
I think it is bad for these reasons when `tests/` contains a mix of
functional and integration tests

 - Concepts is harder to understand, the documentation makes a good
   unit vs functional vs integration distinction, but when the
   integration tests are just two subdirs within `tests/` this is not
   clear.

 - Source filtering in the `flake.nix` is more complex. We need to
   filter out some of the dirs from `tests/`, rather than simply pick
   the dirs we want and take all of them. This is a good sign the
   structure of what we are trying to do is not matching the structure
   of the files.

With this change we have a clean:
```shell-session
$ git show 'HEAD:tests'
tree HEAD:tests

functional/
installer/
nixos/
```
2023-10-06 09:05:56 -04:00
Eelco Dolstra 3dd4475826
Merge pull request #8905 from hercules-ci/no-unknown-location
Don't print unknown locations unless requested for dev purposes
2023-10-06 14:41:01 +02:00
Eelco Dolstra 72c3990bb4
Merge pull request #9104 from fricklerhandwerk/nix-env-links
add links and anchors
2023-10-06 14:24:01 +02:00