Commit graph

15480 commits

Author SHA1 Message Date
Qyriad 6504b9f648 improve assert msg and make nix profile elem detection more robust 2024-04-28 14:52:27 -06:00
Qyriad c529adb996 nix3-upgrade-nix: allow manually specifying the store path for the new nix
Should this specify the profile? The derivation output that gets linked
into that profile? The latter is probably better.

Change-Id: Ib71711ffb466febf4a6892e3fdbda644e053770d
2024-04-28 14:52:00 -06:00
Qyriad 33e433ad68 fix nix upgrade-nix on new-style profiles
nix3-profile automatically migrates any profile its used on to its style
of profile -- the ones with manifest.json instead of manifest.nix. On
non-NixOS systems, Nix is conventionally installed to the profile at
/nix/var/nix/profiles/default, so if a user passed that to `--profile`
of `nix profile`, then it would break upgrade-nix from ever working
again, without recreating the profile.

This commit fixes that, and allows upgrade-nix to work on either kind of
profile.

Fixes #16.

Change-Id: I4c49b1beba93bb50e8f8a107edc451affe08c3f7
2024-04-28 14:52:00 -06:00
Qyriad eb13b2ab3f unfuck commit msg 2024-04-28 01:32:17 -06:00
Qyriad d0a9e7c2ff refactor some nix-env and profile code to libcmd
Notably, ProfileManifest and ProfileElement are useful generic
profile management code, and nix profile is not the only place in the
codebase where profiles are relevant.

This commit is in preparation for fixing upgrade-nix's interaction with
new-style profiles.

Change-Id: Iefc8bbd34b4bc6012175cb3d6e6a8207973bc792
2024-04-28 01:31:21 -06:00
Qyriad 75ec759633 nix3-upgrade-nix: allow manually specifying the store path for the new nix
Should this specify the profile? The derivation output that gets linked
into that profile? The latter is probably better.

Change-Id: Ib71711ffb466febf4a6892e3fdbda644e053770d
2024-04-28 01:31:21 -06:00
Qyriad 3502e27f93 fix nix upgrade-nix on new-style profiles
nix3-profile automatically migrates any profile its used on to its style
of profile -- the ones with manifest.json instead of manifest.nix. On
non-NixOS systems, Nix is conventionally installed to the profile at
/nix/var/nix/profiles/default, so if a user passed that to `--profile`
of `nix profile`, then it would break upgrade-nix from ever working
again, without recreating the profile.

This commit fixes that, and allows upgrade-nix to work on either kind of
profile.

Fixes #16.

Change-Id: I4c49b1beba93bb50e8f8a107edc451affe08c3f7
2024-04-28 01:31:21 -06:00
Qyriad 8fdf7abaef rebase onto main 2024-04-27 23:31:31 -06:00
Qyriad 5c1e2cf195 nix3-upgrade-nix: allow manually specifying the store path for the new nix
Should this specify the profile? The derivation output that gets linked
into that profile? The latter is probably better.

Change-Id: Ib71711ffb466febf4a6892e3fdbda644e053770d
2024-04-27 23:31:23 -06:00
Qyriad 9af156ecb4 fix nix upgrade-nix on new-style profiles
nix3-profile automatically migrates any profile its used on to its style
of profile -- the ones with manifest.json instead of manifest.nix. On
non-NixOS systems, Nix is conventionally installed to the profile at
/nix/var/nix/profiles/default, so if a user passed that to `--profile`
of `nix profile`, then it would break upgrade-nix from ever working
again, without recreating the profile.

This commit fixes that, and allows upgrade-nix to work on either kind of
profile.

Fixes #16.

Change-Id: I4c49b1beba93bb50e8f8a107edc451affe08c3f7
2024-04-27 23:31:23 -06:00
Qyriad b49fd8324a refactor some nix-env and 3-profile code libcmd
Notably, ProfileManifest and ProfileElement are useful generic
profile management code, and nix profile is not the only place in the
codebase where profiles are relevant.

This commit is in preparation for fixing upgrade-nix's interaction with
new-style profiles.

Change-Id: Iefc8bbd34b4bc6012175cb3d6e6a8207973bc792
2024-04-27 23:31:23 -06:00
Qyriad 31708ff8ff good commit message for the libcmd refacotr 2024-04-27 23:15:38 -06:00
Qyriad 23de548850 nix3-upgrade-nix: allow manually specifying the store path for the new nix
Change-Id: Ib71711ffb466febf4a6892e3fdbda644e053770d
2024-04-27 23:15:13 -06:00
Qyriad f881146005 fix nix upgrade-nix on new-style profiles
nix3-profile automatically migrates any profile its used on to its style
of profile -- the ones with manifest.json instead of manifest.nix. On
non-NixOS systems, Nix is conventionally installed to the profile at
/nix/var/nix/profiles/default, so if a user passed that to `--profile`
of `nix profile`, then it would break upgrade-nix from ever working
again, without recreating the profile.

This commit fixes that, and allows upgrade-nix to work on either kind of
profile.

Fixes #16.

Change-Id: I4c49b1beba93bb50e8f8a107edc451affe08c3f7
2024-04-27 23:15:13 -06:00
Qyriad 19e9ada564 refactor some nix-env and 3-profile code libcmd
Notably, ProfileManifest and ProfileElement are useful generic
profile management code, and nix profile is not the only place in the
codebase where profiles are relevant.

This commit is in preparation for fixing upgrade-nix's interaction with
new-style profiles.

Change-Id: Iefc8bbd34b4bc6012175cb3d6e6a8207973bc792
2024-04-27 23:09:54 -06:00
Qyriad 4789077d08 whoops, forgot to remove the unused one from a few commits ago 2024-04-27 23:05:10 -06:00
Qyriad 6194eebae6 fix nix upgrade-nix on new-style profiles
nix3-profile automatically migrates any profile its used on to its style
of profile -- the ones with manifest.json instead of manifest.nix. On
non-NixOS systems, Nix is conventionally installed to the profile at
/nix/var/nix/profiles/default, so if a user passed that to `--profile`
of `nix profile`, then it would break upgrade-nix from ever working
again, without recreating the profile.

This commit fixes that, and allows upgrade-nix to work on either kind of
profile.

Fixes #16.

Change-Id: I4c49b1beba93bb50e8f8a107edc451affe08c3f7
2024-04-27 23:04:56 -06:00
Qyriad 11ce7c65a9 cleanup! factor upgradeNewStyleProfile to its own function 2024-04-27 23:04:22 -06:00
Qyriad b636118030 fix nix upgrade-nix on new-style profiles
nix3-profile automatically migrates any profile its used on to its style
of profile -- the ones with manifest.json instead of manifest.nix. On
non-NixOS systems, Nix is conventionally installed to the profile at
/nix/var/nix/profiles/default, so if a user passed that to `--profile`
of `nix profile`, then it would break upgrade-nix from ever working
again, without recreating the profile.

This commit fixes that, and allows upgrade-nix to work on either kind of
profile.

Fixes #16.

Change-Id: I4c49b1beba93bb50e8f8a107edc451affe08c3f7
2024-04-27 22:52:02 -06:00
Qyriad 1ec6411d42 will the real MVP please stand up 2024-04-27 22:18:17 -06:00
Qyriad 05756b90cf mvp
Change-Id: I4c49b1beba93bb50e8f8a107edc451affe08c3f7
2024-04-27 22:18:09 -06:00
Qyriad 7f3514f94e whitespace 2024-04-27 20:43:12 -06:00
Qyriad a00cb15b77 refactor some nix-env and nix profile code into libcmd
Change-Id: Iefc8bbd34b4bc6012175cb3d6e6a8207973bc792
2024-04-27 20:43:04 -06:00
Qyriad 37a2e02662 mvp
Change-Id: I4c49b1beba93bb50e8f8a107edc451affe08c3f7
2024-04-27 20:43:04 -06:00
Qyriad 229ef1609f ProfileManifest 2024-04-27 20:40:20 -06:00
Qyriad c3f1603ef9 mvp
Change-Id: I4c49b1beba93bb50e8f8a107edc451affe08c3f7
2024-04-27 20:40:12 -06:00
Qyriad 581bb8eb82 refactor some nix-env and nix profile code into libcmd
Change-Id: Iefc8bbd34b4bc6012175cb3d6e6a8207973bc792
2024-04-27 20:40:12 -06:00
Qyriad b2f94107e2 ProfileElement 2024-04-27 18:45:48 -06:00
Qyriad a7c0aefb64 mvp
Change-Id: I4c49b1beba93bb50e8f8a107edc451affe08c3f7
2024-04-27 18:45:36 -06:00
Qyriad 1d00657e9b refactor some nix-env and nix profile code into libcmd
Change-Id: Iefc8bbd34b4bc6012175cb3d6e6a8207973bc792
2024-04-27 18:45:36 -06:00
Qyriad 19e1ad9193 mvp 2024-04-27 17:29:01 -06:00
Qyriad a514712224 mvp
Change-Id: I4c49b1beba93bb50e8f8a107edc451affe08c3f7
2024-04-27 17:28:56 -06:00
Qyriad f9b3dd5208 ProfileElementSource 2024-04-27 14:44:54 -06:00
Qyriad 49886ce0dc refactor some nix-env and nix profile code into libcmd
Change-Id: Iefc8bbd34b4bc6012175cb3d6e6a8207973bc792
2024-04-27 14:44:37 -06:00
Qyriad 057e663de8 queryInstalled, showVersions 2024-04-27 13:25:18 -06:00
Qyriad 91ea6aaf4f refactor some nix-env and nix profile code into libcmd
Change-Id: Iefc8bbd34b4bc6012175cb3d6e6a8207973bc792
2024-04-27 13:24:39 -06:00
Qyriad 76b45b4861 Merge "docs(nix-env): summarize of each subcommand in --help" into main 2024-04-27 18:42:46 +00:00
puck 9229e87347 Fix progress bar on copyPaths
This variable should not be shared between activities.

Change-Id: I4eee89bc7acb320a3972dc3a55bfb087d3a9eb3a
2024-04-27 18:03:15 +00:00
Ilya K 9462c01c3e libstore/ssh: shut
This is just logspam, and we have NIX_SSHOPTS for people that want the logspam.

Change-Id: Ieff71473686f0661f9c53c212f8952dd2c9565c3
2024-04-27 12:05:17 +03:00
Qyriad a38bd6db3d trying this again 2024-04-27 00:39:30 -06:00
Qyriad 39cd71cf58 init 2024-04-27 00:17:44 -06:00
Qyriad abb6ff3111 refactor profile code from nix-env and nix profile to libcmd
Change-Id: I94e948ff6b92af7d0ab53b17c1570b7549c3b4e0
2024-04-27 00:17:33 -06:00
Qyriad 78ce710722 docs(nix-env): summarize of each subcommand in --help
This should have been there from the beginning. As much as nix-env is a
pile of problems we don't need trivial docs papercuts like this adding
to it.

Change-Id: I0c53e4b146af2fefdd0e4743d850672729cb2194
2024-04-26 21:56:08 -06:00
Maximilian Bosch 8773439a85 Merge "ssh-ng: Set log-fd for ssh to 4 by default" into main 2024-04-26 18:30:33 +00:00
Artemis Tosini 789aa39576 Merge "gc: Find roots using libproc on Darwin" into main 2024-04-26 17:26:45 +00:00
Maximilian Bosch 104448e75d ssh-ng: Set log-fd for ssh to 4 by default
That's expected by `build-remote` and makes sure that errors are
correctly forwarded to the user. For instance, let's say that the
host-key of `example.org` is unknown and

    nix-build ../nixpkgs -A hello -j0 --builders 'ssh-ng://example.org'

is issued, then you get the following output:

    cannot build on 'ssh-ng://example.org?&': error: failed to start SSH connection to 'example.org'
    Failed to find a machine for remote build!
    derivation: yh46gakxq3kchrbihwxvpn5bmadcw90b-hello-2.12.1.drv
    required (system, features): (x86_64-linux, [])
    2 available machines:
    [...]

The relevant information (`Host key verification failed`) ends up in the
daemon's log, but that's not very obvious considering that the daemon
isn't very chatty normally.

This can be fixed - the same way as its done for legacy-ssh - by passing
fd 4 to the SSH wrapper. Now you'd get the following error:

    cannot build on 'ssh-ng://example.org': error: failed to start SSH connection to 'example.org': Host key verification failed.
    Failed to find a machine for remote build!
    [...]

...and now it's clear what's wrong.

Please note that this is won't end up in the derivation's log.

For previous discussion about this change see
https://github.com/NixOS/nix/pull/7659.

Change-Id: I5790856dbf58e53ea3e63238b015ea06c347cf92
2024-04-26 19:04:06 +02:00
eldritch horrors a1ad4e52a6 filetransfer: don't decompress in curl wrapper itself
only decompress the response once all data has been received (in the
fully buffered case), or at least outside of the curl wrapper itself
(in the receive-to-sink case). unfortunately this means we will have
to duplicate decompression logic for these two cases for time being,
but once the curl wrapper has been rewritten to return a real future
or Source we can deduplicate this logic again. the curl wrapper will
have to turn into a proper Source first and use decompression source
logic which also does not currently exist—only decompression *sinks*

Change-Id: I66bc692f07d9b9e69fe10689ee73a2de8d65e35c
2024-04-26 15:26:37 +00:00
eldritch horrors fb0996aaa8 filetransfer: remove dataCallback from interface
this is highly questionable. single-arg download calls will misbehave
with it set, and two-arg download calls will just overwrite it. being
an implementation detail this should not have been in the API at all.

Change-Id: I613772951ee03d8302366085f06a53601d13f132
2024-04-26 15:26:37 +00:00
eldritch horrors dfe3baea12 filetransfer: make two-arg download abstract
this lets each implementation of FileTransfer (of which currently only
the one exists at all) implement appropriate handling for its internal
behaviours that are not otherwise exposed. in curl this lets us switch
the buffer-full handling method from "block the entire curl thread" to
"pause just the one transfer", move the non-libcurl body decompression
out of the actual curl wrapper (which will let us eventually morph the
curl wrapper intto an actual source of Sources), and some other things

Change-Id: Id6d3593cde6b4915aab3e90a43b175c103cc3f18
2024-04-26 15:26:37 +00:00
Maximilian Bosch ce76d3eab2 Merge "justfile: allow passing args to meson compile" into main 2024-04-26 07:45:22 +00:00