Commit graph

11639 commits

Author SHA1 Message Date
Eelco Dolstra
afcdc7606c Remove std::list alias 2022-02-21 16:25:12 +01:00
Eelco Dolstra
e2422c4582
Merge pull request #6052 from hercules-ci/issue-3294-fix-interruptCallback-deadlock
Fix deadlocked nix-daemon zombies on darwin #3294
2022-02-21 16:21:45 +01:00
Robert Hensing
ddb6740e7d triggerInterrupt: Refactor to use break 2022-02-21 15:43:43 +01:00
Nicolas Mattia
44b7d104b4 Document usage of MANPATH in nix-profile.sh
While trying to figure out how `nix-env`/`nix profile` work I had a hard
time understand how man pages were being installed.

Took me quite some time to figure this out, thought it might be useful
to others too!
2022-02-21 13:35:55 +01:00
Eelco Dolstra
f22b9e72f5
Merge pull request #6120 from mayflower/print-full-names
path-info: use full store paths when we have them
2022-02-21 11:03:20 +01:00
Matthew Bauer
61295b910f Add verbosity to nix profile upgrade
Followup of https://github.com/NixOS/nix/pull/6086. This time adding a
warning if no packages are upgraded.
2022-02-20 23:46:11 -06:00
Maximilian Bosch
fd170774c6
libstore/build: add a few explanatory comments; simplify 2022-02-20 16:02:44 +01:00
Maximilian Bosch
a539093919
tests: implement test for nix log with ssh-ng:// builds
A few notes:

* The `echo hi` is needed to make sure that a file that can be read by
  `nix log` is properly created (i.e. some output is needed). This is
  known and to be fixed in #6051.
* We explicitly ignore the floating-CA case here: the `$out` of `input3`
  depends on `$out` of `input2`. This means that there are actually two
  derivations - I assume that this is because at eval time (i.e.
  `nix-instantiate -A`) the hash of `input2` isn't known yet and the
  other .drv is created as soon as `input2` was built. This is another
  issue on its own, so we ignore the case here explicitly.
2022-02-20 15:56:22 +01:00
Maximilian Bosch
8a83e34c1e
libstore/derivation-goal: avoid double-parsing of JSON messages
To avoid that JSON messages are parsed twice in case of
remote builds with `ssh-ng://`, I split up the original
`handleJSONLogMessage` into three parts:

* `parseJSONMessage(const std::string&)` checks if it's a message in the
  form of `@nix {...}` and tries to parse it (and prints an error if the
  parsing fails).
* `handleJSONLogMessage(nlohmann::json&, ...)` reads the fields from the
  message and passes them to the logger.
* `handleJSONLogMessage(const std::string&, ...)` behaves as before, but
  uses the two functions mentioned above as implementation.

In case of `ssh-ng://`-logs the first two methods are invoked manually.
2022-02-19 22:48:01 +01:00
Maximilian Bosch
3d525e96c0
ssh-ng: also store build logs to make them accessible by nix log
Right now when building a derivation remotely via

    $ nix build -j0 -f . hello -L --builders 'ssh://builder'

it's possible later to read through the entire build-log by running
`nix log -f . hello`. This isn't possible however when using `ssh-ng`
rather than `ssh`.

The reason for that is that there are two different ways to transfer
logs in Nix through e.g. an SSH tunnel (that are used by `ssh`/`ssh-ng`
respectively):

* `ssh://` receives its logs from the fd pointing to `builderOut`. This
  is directly passed to the "log-sink" (and to the logger on each `\n`),
  hence `nix log` works here.
* `ssh-ng://` however expects JSON-like messages (i.e. `@nix {log data
  in here}`) and passes it directly to the logger without doing anything
  with the `logSink`. However it's certainly possible to extract
  log-lines from this format as these have their own message-type in the
  JSON payload (i.e. `resBuildLogLine`).

  This is basically what I changed in this patch: if the code-path for
  `builderOut` is not reached and a `logSink` is initialized, the
  message was successfully processed by the JSON logger (i.e. it's in
  the expected format) and the line is of the expected type (i.e.
  `resBuildLogLine`), the line will be written to the log-sink as well.

Closes #5079
2022-02-19 21:35:34 +01:00
Naïm Favier
f62f61331c
Add shell completion for --override-flake
Requires moving the MixEvalArgs class from libexpr to libcmd because
that's where completeFlakeRef is.
2022-02-19 18:57:09 +01:00
Naïm Favier
d69a1117a4
Perform tilde expansion when completing flake fragments
Allows completing `nix build ~/flake#<Tab>`.
We can implement expansion for `~user` later if needed.
Not using wordexp(3) since that expands way too much.
2022-02-19 18:57:09 +01:00
Naïm Favier
6576f0db06
Make completeDir follow symlinks
Allows completing `nix why-depends /run/cur<Tab>` to /run/current-system
2022-02-19 18:57:09 +01:00
Naïm Favier
dbdd3f6f8e
Ensure the completion marker is not processed beyond completion
I was surprised to see an error mentioning ___COMPLETE___ when trying to
complete a flag argument that had no completer implemented
2022-02-19 18:53:15 +01:00
Naïm Favier
9f2a2251b6
Fix completion of nested attributes in completeInstallable
Without this, completing `nix eval -f file.nix foo.<Tab>` suggests `bar`
instead of `foo.bar`, which messes up the command
2022-02-19 18:51:18 +01:00
Naïm Favier
989195752e
Add shell completion for --override-input 2022-02-19 18:36:02 +01:00
Travis A. Everett
1fd127a068 install-darwin: fix mount permission edge-case
Fixes #6122, which reports a problem with trying to run the installer
under another user (probably: user is not the disk "owner" and thus
can't mount the volume).
2022-02-18 23:15:37 -06:00
Linus Heckemann
dbdc63bc41 path-info: use full store paths when we have them
Fixes #5645
2022-02-19 00:32:05 +01:00
Eelco Dolstra
9bc03adbba
Integrate push-docker.sh into the release script
This also makes sure that we get the Docker images from the same Hydra
eval, rather than the latest build from job/nix/.../dockerImage, which
may not be the same.
2022-02-18 13:58:01 +01:00
Naïm Favier
505bf2cb7d
Accept and discard fragments in getFlakeRefForCompletion
Otherwise trying to complete `nix build foo#bar --update-input <Tab>`
fails with "unexpected fragment"
2022-02-18 13:19:57 +01:00
Eelco Dolstra
50e3840f14
Merge remote-tracking branch 'origin/script-to-make-docker-release' 2022-02-18 10:55:07 +01:00
Eelco Dolstra
26e99c817c
Merge pull request #6114 from Radvendii/welcomeText
add release notes for welcomeText
2022-02-18 10:52:03 +01:00
Rok Garbas
f0de5fb8e7
remove the manifest before creating them 2022-02-18 00:32:38 +01:00
Rok Garbas
bf435664d7
Merge remote-tracking branch 'origin/master' into script-to-make-docker-release 2022-02-18 00:15:23 +01:00
Taeer Bar-Yam
219fa2e43d add release notes for welcomeText 2022-02-17 15:17:20 -05:00
Eelco Dolstra
a768e85e2f
Merge pull request #6103 from Radvendii/welcomeText
add descriptive output when creating templates
2022-02-17 21:06:10 +01:00
Taeer Bar-Yam
f56dd3a36b make flake template welcomeText markdown 2022-02-17 13:59:32 -05:00
Eelco Dolstra
b24d541c34
Merge pull request #6110 from layus/patch-2
Create daemon-socket folder during install
2022-02-17 13:00:20 +01:00
Guillaume Maudoux
1bec333788
Create to daemon-socket folder during install 2022-02-17 09:32:15 +01:00
Eelco Dolstra
aa5b83d93c InputScheme::fetch(): Return a StorePath instead of a Tree 2022-02-16 11:14:01 +01:00
Eelco Dolstra
2d6d9a28eb addToStoreFromDump(): Take std::string_view 2022-02-16 11:02:35 +01:00
Eelco Dolstra
f450edc78b
Merge pull request #6104 from rrbutani/master
Fix formatting for options with "machine-specific" defaults
2022-02-16 10:47:51 +01:00
Rahul Butani
d82cf4a016
manual: fix formatting for options with "machine-specific" defaults 2022-02-15 15:44:05 -06:00
Taeer Bar-Yam
f3a2940e70 add descriptive output when creating templates
this includes a `welcomeText` attribute which can be set in the
template, as well as outputing which files were created.
2022-02-15 11:50:14 -05:00
Gabriel Fontes
72e8f94081
add sourcehut input scheme 2022-02-14 23:53:01 -03:00
Eelco Dolstra
94992a9196
Merge pull request #6100 from edolstra/installables-cleanup
InstallableFlake: Default attr paths cleanup
2022-02-14 22:06:11 +01:00
Eelco Dolstra
023e459777 InstallableFlake: Default attr paths cleanup
This removes some duplicated logic, and fixes "nix bundle" parsing its
installable twice.
2022-02-14 21:06:11 +01:00
Eelco Dolstra
744a101a36
Merge pull request #6092 from Kha/sandbox-wo-userns
Fix using sandbox without user namespaces
2022-02-14 11:40:08 +01:00
Sebastian Ullrich
c437e1326d Fix using sandbox without user namespaces 2022-02-12 16:28:36 +01:00
Eelco Dolstra
4d67ecbbb2
Merge pull request #6085 from edolstra/fix-flake-defaults
parseInstallables(): Don't try the flake attr path prefixes when no fragment is specified
2022-02-11 18:00:00 +01:00
Eelco Dolstra
36845dc9a3
Merge pull request #6086 from tomberek/profile_remove
profile: add verbosity
2022-02-11 16:47:11 +01:00
Tom Bereknyei
270fb5f192 profile: add verbosity
warn if there are no matches and give notice of removing packages as
they are found
2022-02-11 10:44:33 -05:00
Eelco Dolstra
cdc90c2776 parseInstallables(): Don't try the flake attr path prefixes when no fragment is specified
Fixes #5880.
2022-02-11 15:50:12 +01:00
Eelco Dolstra
d2f9a081b8 flake.nix: Fix indent 2022-02-11 14:45:46 +01:00
Eelco Dolstra
5b809f9e0e check-hydra-status.sh: Ignore unfinished builds 2022-02-10 21:15:07 +01:00
Maximilian Bosch
5b586575ac
nix/why-depends: fix output when not using --precise
On Nix 2.6 the output of `nix why-depends --all` seems to be somewhat
off:

    $ nix why-depends /nix/store/kn47hayxab8gc01jhr98dwyywbx561aq-nixos-system-roflmayr-21.11.20220207.6c202a9.drv /nix/store/srn5jbs1q30jpybdmxqrwskyny659qgc-nix-2.6.drv --derivation  --extra-experimental-features nix-command  --all
    /nix/store/kn47hayxab8gc01jhr98dwyywbx561aq-nixos-system-roflmayr-21.11.20220207.6c202a9.drv
        └───/nix/store/g8bpgfjhh5vxrdq0w6r6s64f9kkm9z6c-etc.drv
        │   └───/nix/store/hm0jmhp8shbf3cl846a685nv4f5cp3fy-nspawn-inst.drv
        | [...]
            └───/nix/store/2d6q3ygiim9ijl5d4h0qqx6vnjgxywyr-system-units.drv
                └───/nix/store/dil014y1b8qyjhhhf5fpaah5fzdf0bzs-unit-systemd-nspawn-hydra.service.drv
                    └───/nix/store/a9r72wwx8qrxyp7hjydyg0gsrwnn26zb-activate.drv
                        └───/nix/store/99hlc7i4gl77wq087lbhag4hkf3kvssj-nixos-system-hydra-21.11pre-git.drv

Please note that `[...]-system-units.drv` is supposed to be a direct
child of `[...]-etc.drv`.

The reason for that is that each new level printed by `printNode` is
four spaces off in comparison to `nix why-depends --precise` because the
recursive `printNode()` only prints the path and not the `tree*`-chars in
the case of `--precise` and in this format the path is four spaces further
indented, i.e. on a newline, but on the same level as the path's children, i.e.

    /nix/store/kn47hayxab8gc01jhr98dwyywbx561aq-nixos-system-roflmayr-21.11.20220207.6c202a9.drv
    └───/: …1-p8.drv",["out"]),("/nix/store/g8bpgfjhh5vxrdq0w6r6s64f9kkm9z6c-etc.drv",["out"]),("/nix/store/…
        → /nix/store/g8bpgfjhh5vxrdq0w6r6s64f9kkm9z6c-etc.drv

As you can see `[...]-etc.drv` is a direct child of the root, but four
spaces indented. This logic was directly applied to the code-path with
`precise=false` which resulted in `tree*` being printed four spaces too
deep.

In case of no `--precise`, `hits[hash]` is empty and the path itself
should be printed rather than hits using the same logic as for `hits[hash]`.

With this fix, the output looks correct now:

    /nix/store/kn47hayxab8gc01jhr98dwyywbx561aq-nixos-system-roflmayr-21.11.20220207.6c202a9.drv
    └───/nix/store/g8bpgfjhh5vxrdq0w6r6s64f9kkm9z6c-etc.drv
        ├───/nix/store/hm0jmhp8shbf3cl846a685nv4f5cp3fy-nspawn-inst.drv
        | [...]
        └───/nix/store/2d6q3ygiim9ijl5d4h0qqx6vnjgxywyr-system-units.drv
            └───/nix/store/dil014y1b8qyjhhhf5fpaah5fzdf0bzs-unit-systemd-nspawn-hydra.service.drv
                └───/nix/store/a9r72wwx8qrxyp7hjydyg0gsrwnn26zb-activate.drv
                    └───/nix/store/99hlc7i4gl77wq087lbhag4hkf3kvssj-nixos-system-hydra-21.11pre-git.drv
2022-02-10 14:26:00 +01:00
Eelco Dolstra
b8d57e2883 check-hydra-status.sh: Improve error behaviour 2022-02-10 11:10:58 +01:00
Eelco Dolstra
52f52319ad
Merge pull request #6067 from trofi/revert-6060-prefer-inplace-libs
Revert "mk: prefert inplace library paths to system ones (take 2)"
2022-02-09 14:24:54 +01:00
Sergei Trofimovich
28b9bd784c
Revert "mk: prefert inplace library paths to system ones (take 2)" 2022-02-09 13:00:53 +00:00
Eelco Dolstra
0b3d8e1a29
Merge pull request #6060 from trofi/prefer-inplace-libs
mk: prefert inplace library paths to system ones (take 2)
2022-02-08 19:49:21 +01:00