Commit graph

13916 commits

Author SHA1 Message Date
John Ericson 7c4dea3cf3 Punt on improper global flags for now
See the note in the test.

We don't want these flags showing up for commands where they are
irrelevant.

Eventually, this needs a proper fix, but it need not be a blocker for
stabilize: for a quick-n-dirty punt, just put these flags behind the
`nix-command` unstable feature.

This is fine because they are only relevant for commands which we don't
need to stabilize for a while.
2023-03-27 09:21:50 -04:00
John Ericson 570829d67e
Merge pull request #7609 from obsidiansystems/hide-experimental-settings
Hide experimental settings
2023-03-27 09:19:29 -04:00
Eelco Dolstra 2523448bad
Merge pull request #8104 from avdv/graphml-use-long-for-narsize
nix-store: Use `long` for `narSize` in graphml output
2023-03-27 13:10:28 +02:00
Robert Hensing 9e7940e35d
Merge pull request #8109 from oxalica/fix/show-legacy-packages
Catch eval errors in `hasContent`
2023-03-27 05:46:49 +02:00
Robert Hensing 6b87c6577f
tests/flakes/show.sh: Broaden requirement comment 2023-03-27 05:11:23 +02:00
oxalica 2941a599fa Catch eval errors in hasContent
`legacyPackages` of nixpkgs trigger eval errors in `hasContent`, causing
the whole `legacyPackages` being skipped. We should treat it as
has-content in that case.
2023-03-26 23:05:29 +08:00
Claudio Bley e7b9dc7c89 nix-store: Use long for narSize in graphml output 2023-03-24 17:25:17 +01:00
Eelco Dolstra e00abd3f56
Merge pull request #7757 from obsidiansystems/more-installable-value
Move value-only methods to `InstallableValue`
2023-03-24 14:07:18 +01:00
Théophane Hufschmitt a4c2cd3c06
Merge pull request #8098 from hercules-ci/error-cc-Only-suggest-show-trace-when-truncated-trace-items-would-be-pri
error.cc: Only suggest `--show-trace` when relevant
2023-03-24 12:07:44 +01:00
Théophane Hufschmitt eed43de02f
Merge pull request #8096 from tweag/filter-tests
Filter tests/nixos from source
2023-03-24 12:06:26 +01:00
Alexander Bantyev 80f9231b69
Filter tests/nixos from source 2023-03-24 14:29:28 +04:00
Robert Hensing 233c4cf30f error.cc: Only suggest show-trace when truncated trace items would be printed
Otherwise, a trace consisting of

frame
frame
frame
non-frame

... would reach the non-frame and print the suggestion, even though
it would have ignored the non-frame anyway.

This resulted in a peculariar situation where --show-trace would have
no apparent effect, as the trace was actually already complete.
2023-03-23 17:29:06 +01:00
Eelco Dolstra fbc296e00f
Merge pull request #8095 from fricklerhandwerk/operators-formatting
doc: force line breaks where needed
2023-03-23 09:24:54 +01:00
John Ericson e5146a6a50
Merge pull request #8078 from obsidiansystems/profile-md
Fix `nix profile --help`
2023-03-22 19:36:12 -04:00
Valentin Gagarin 0ced5132fd
Merge pull request #6865 from zuzuleinen/manual-nix-path-empty
document what happens when NIX_PATH is empty
2023-03-23 00:10:17 +01:00
Valentin Gagarin 96129246ad
add links 2023-03-22 23:37:27 +01:00
Valentin Gagarin 40eb88e427 doc: force line breaks where needed 2023-03-22 22:46:23 +01:00
Alex Wied 6dbce3215f
docker.nix: add an option to include flake-registry inside docker image (#6750)
Co-authored-by: Alex Wied <centromere@users.noreply.github.com>
Co-authored-by: Rok Garbas <rok@floxdev.com>
2023-03-22 20:55:02 +01:00
Eelco Dolstra 006291e5be
Merge pull request #8082 from edolstra/add-links
Add links to API docs / coverage analysis to the hacking section
2023-03-22 11:27:18 +01:00
Eelco Dolstra 4dcc0a1b76
Merge pull request #8085 from edolstra/fetchGit-md
Fix rendering of fetchGit documentation
2023-03-21 15:24:54 +01:00
Eelco Dolstra 16cb9b9f04 Fix rendering of fetchGit documentation
stripIndentation() doesn't support tabs, so the entire markdown ended
up indented and thus rendered as a code block.
2023-03-21 14:48:15 +01:00
Eelco Dolstra cdfa59daa1
Merge pull request #8083 from edolstra/fix-nix-store-rendering
Fix misrendering of 'nix store --help'
2023-03-21 12:38:29 +01:00
Eelco Dolstra 6f62cb3611 generate-manpage.nix: Make more readable 2023-03-21 12:11:32 +01:00
Eelco Dolstra 3ac3e31c4d Fix misrendering of 'nix store --help'
There are no categories underneath 'nix store', so having 'nix store
copy-log' in a category rendered as ':'.
2023-03-21 12:02:19 +01:00
Eelco Dolstra 4b9add9b35 Add links to API docs / coverage analysis to the hacking section 2023-03-21 11:47:21 +01:00
Eelco Dolstra 1de5b0e4e6
Merge pull request #8077 from edolstra/pts-hang
Open slave pseudoterminal before CLONE_NEWUSER
2023-03-20 20:33:28 +01:00
John Ericson f87f1bbfe6 Fix nix profile --help
The documentation hadn't be updated to reflect the new default profile
location.
2023-03-20 14:22:23 -04:00
Eelco Dolstra 515662ad70 Cleanup 2023-03-20 18:06:08 +01:00
Eelco Dolstra 16db8dc96f Open slave pseudoterminal before CLONE_NEWUSER
Otherwise, when running as root and user namespaces are enabled,
opening the slave fails with EPERM.

Fixes "opening pseudoterminal slave: Permission denied" followed by a
hang (https://hydra.nixos.org/build/213104244), and "error: getting
sandbox mount namespace: No such file or directory" (#8072), which
happens when the child fails very quickly and consequently reading
/proc/<child>/ns fails.
2023-03-20 17:58:36 +01:00
John Ericson 4607ac7aed Fix handling of experimental features mid-parse
If we conditionally "declare" the argument, as we did before, based upon
weather the feature is enabled, commands like

    nix --experimental-features=foo ... --thing-gated-on-foo

won't work, because the experimental feature isn't enabled until *after*
we start parsing.

Instead, allow arguments to also be associated with experimental
features (just as we did for builtins and settings), and then the
command line parser will filter out the experimental ones.

Since the effects of arguments (handler functions) are performed right
away, we get the required behavior: earlier arguments can enable later
arguments enabled!

There is just one catch: we want to keep non-positional
flags...non-positional. So if

    nix --experimental-features=foo ... --thing-gated-on-foo

works, then

    nix --thing-gated-on-foo --experimental-features=foo ...

should also work.

This is not my favorite long-term solution, but for now this is
implemented by delaying the requirement of needed experimental features
until *after* all the arguments have been parsed.
2023-03-20 11:35:34 -04:00
John Ericson aa663b7e89 Mark experimental features on settings
We hide them in various ways if the experimental feature isn't enabled.

To do this, we had to move the experimental features list out of
libnixstore, because the setting machinary itself depends on it. To do
that, we made a new `ExperimentalFeatureSettings`.
2023-03-20 11:06:40 -04:00
John Ericson 296831f641 Move enabled experimental feature to libutil struct
This is needed in subsequent commits to allow the settings and CLI args
infrastructure itself to read this setting.
2023-03-20 11:05:22 -04:00
John Ericson 1b6c96bbcb Write test, will fail until rest of PR 2023-03-20 09:17:33 -04:00
Eelco Dolstra 83b977ff07
Merge pull request #8075 from edolstra/api-docs
Fix internal-api rendering in Hydra
2023-03-20 13:51:07 +01:00
Eelco Dolstra 658847179a Fix internal-api rendering in Hydra
Currently it gives a 500 error with "Do not know how to serve path
'/nix/store/bym5sm8z2wpavnvzancb9gjdlgyzs1l8-nix-internal-api-docs-2.15.0pre20230320_e37f436/share/doc/nix/internal-api'."
2023-03-20 13:13:57 +01:00
Théophane Hufschmitt 1fcbdecf15
Merge pull request #7968 from bobvanderlinden/pr-contributing
Add CONTRIBUTING.md
2023-03-20 13:13:12 +01:00
Eelco Dolstra e37f436eb4
Merge pull request #8070 from figsoda/quote
docs: quote URL literals
2023-03-20 11:18:09 +01:00
Eelco Dolstra 0d314bbfe8
Merge pull request #8068 from DieracDelta/jr/compile_darwin
Fix build aarch64-darwin for static library
2023-03-20 11:17:46 +01:00
figsoda 54b8da0b10 docs: quote URL literals 2023-03-19 11:28:10 -04:00
Justin Restivo 220aa8e0ac fix: build aarch64-darwin 2023-03-18 17:53:45 -04:00
Robert Hensing b5b6055bbf
Merge pull request #8064 from knedlsepp/flake-in-submodule
Add a test with flake.nix in a git submodule
2023-03-18 15:07:38 +01:00
Robert Hensing bf0c8c34e7
tests/flake-in-submodule: Remove unnecessary rm -rf 2023-03-18 14:39:38 +01:00
Josef Kemetmüller f9c24d67b9 Add a test with flake.nix in a submodule
I noticed a regression in the lazy-trees branch, which I'm trying to
capture with this test. While the tests succeeds in master, the
lazy-trees branch gives the following error message:

    error: access to path
    '/build/nix-test/tests/flakes/flake-in-submodule/rootRepo/submodule/flake.nix'
    is forbidden because it is not under Git control; maybe you should
    'git add' it to the repository
    '/build/nix-test/tests/flakes/flake-in-submodule/rootRepo'?
2023-03-17 22:10:28 +01:00
John Ericson 790dd2555b
Merge pull request #7891 from mupdt/shared-fs-out-links
no-op refactor: extract outLink generation into a function
2023-03-17 10:57:07 -04:00
John Ericson c998e0172f Move value-only methods to InstallableValue
These methods would previously fail on the other `Installable`s, so
moving them to this class is more correct as to where they actually
work.

Additionally, a `InstallableValueCommand` is created to make it easier
(or rather no worse than before) to write commands that just work on
`InstallableValue`s.

Besides being a cleanup to avoid failing default methods, this gets us
closer to https://github.com/NixOS/rfcs/pull/134.
2023-03-16 20:06:46 -04:00
John Ericson acd707acca
Merge pull request #8057 from obsidiansystems/slight-test-cleanup
Cleanup	test skipping
2023-03-16 19:13:03 -04:00
John Ericson bfb9eb87fe Cleanup test skipping
- Try not to put cryptic "99" in many places

  Factor out `exit 99` into `skipTest` function

- Alows make sure skipping a test is done with a reason

  `skipTest` takes a mandatory argument

- Separate pure conditionals vs side-effectful test skipping.

  "require daemon" already had this, but "sandbox support" did not.
2023-03-16 18:43:03 -04:00
Eelco Dolstra 7f46ebcf90
Merge pull request #8049 from edolstra/unexpected-eof
Fix "unexpected EOF" errors on macOS
2023-03-16 16:13:42 +01:00
Eelco Dolstra 581e11cd55
Merge pull request #8053 from DeterminateSystems/fix-structuredattrs-sandbox
LocalDerivationGoal: set NIX_ATTRS_*_FILE correctly for sandboxed builds
2023-03-16 16:04:30 +01:00
Linus Heckemann af4cbdafe7 LocalDerivationGoal: set NIX_ATTRS_*_FILE correctly for sandboxed builds 2023-03-16 15:26:52 +01:00