nix flake show cancels the entire print if one item doesn't match the expected schema #768

Open
opened 2025-03-26 03:23:29 +00:00 by srxl · 0 comments
Member

Describe the bug

When running nix flake show on a flake that contains attributes that don't match what the Lix CLI tool expects to be in that place (eg. something that isn't a derivation in devShells.${system}), Lix prints an error message (eg. error: expected a derivation) and exits, without showing the rest of the outputs. This is annoying when I want to see other parts of the flake that Lix might be able to show with no problems, but it never prints them because an earlier failure in one path terminated the entire print.

Steps To Reproduce

Using the Lix 2.92.0 release flake as an example:

  1. Run nix flake show https://git.lix.systems/lix-project/lix/archive/2.92.0.tar.gz
  2. Observe that the command fails in the middle of printing devShells

Example output (with some omissions for brevity:

https://git.lix.systems/api/v1/repos/lix-project/lix/archive/2837da71ec1588c1187d2e554719b15904a46c8b.tar.gz?narHash=sha256-CCKIAE84dzkrnlxJCKFyffAxP3yfsOAbdvydUGqq24g%3D&rev=2837da71ec1588c1187d2e554719b15904a46c8b
├───checks
[...]
├───devShells
│   ├───aarch64-darwin
[...]
│   ├───aarch64-linux
[...]
│   ├───i686-linux
[...]
│   ├───x86_64-darwin
[...]
│   └───x86_64-linux
│       ├───aarch64-linux: development environment 'lix-shell-env-aarch64-unknown-linux-gnu'
│       ├───armv6l-linux: development environment 'lix-shell-env-armv6l-unknown-linux-gnueabihf'
│       ├───armv7l-linux: development environment 'lix-shell-env-armv7l-unknown-linux-gnueabihf'
│       ├───default: development environment 'lix-shell-env'
error: expected a derivation

Expected behavior

I'd expect to see something like the following, where the error is logged for that one path and printing continues, eg.

│       ├───aarch64-linux: development environment 'lix-shell-env-aarch64-unknown-linux-gnu'
│       ├───armv6l-linux: development environment 'lix-shell-env-armv6l-unknown-linux-gnueabihf'
│       ├───armv7l-linux: development environment 'lix-shell-env-armv7l-unknown-linux-gnueabihf'
│       ├───default: development environment 'lix-shell-env'
│       ├───badPath: error: expected a derivation
│       └───goodPath: development environment '...'
├───packages
│   ├───aarch64-darwin
[...]

nix --version output

nix (Lix, like Nix) 2.93.0-dev-6059cbb
System type: x86_64-linux
Additional system types: i686-linux, x86_64-v1-linux, x86_64-v2-linux, x86_64-v3-linux, x86_64-v4-linux
Features: gc, signed-caches
System configuration file: /etc/nix/nix.conf
User configuration files: /home/ruby/.config/nix/nix.conf:/etc/xdg/nix/nix.conf:/home/ruby/.nix-profile/etc/xdg/nix/nix.conf:/nix/profile/etc/xdg/nix/nix.conf:/home/ruby/.local/state/nix/profile/etc/xdg/nix/nix.conf:/etc/profiles/per-user/ruby/etc/xdg/nix/nix.conf:/nix/var/nix/profiles/default/etc/xdg/nix/nix.conf:/run/current-system/sw/etc/xdg/nix/nix.conf
Store directory: /nix/store
State directory: /nix/var/nix
Data directory: /nix/store/pnwhaxn8c3480k1jmq6aiyvnm75wbs8c-lix-2.93.0-dev-6059cbb/share

Also reproducible on most recent stable release:

nix (Lix, like Nix) 2.92.0
System type: x86_64-linux
Additional system types: i686-linux, x86_64-v1-linux, x86_64-v2-linux, x86_64-v3-linux, x86_64-v4-linux
Features: gc, signed-caches
System configuration file: /etc/nix/nix.conf
User configuration files: /home/ruby/.config/nix/nix.conf:/etc/xdg/nix/nix.conf:/home/ruby/.nix-profile/etc/xdg/nix/nix.conf:/nix/profile/etc/xdg/nix/nix.conf:/home/ruby/.local/state/nix/profile/etc/xdg/nix/nix.conf:/etc/profiles/per-user/ruby/etc/xdg/nix/nix.conf:/nix/var/nix/profiles/default/etc/xdg/nix/nix.conf:/run/current-system/sw/etc/xdg/nix/nix.conf
Store directory: /nix/store
State directory: /nix/var/nix
Data directory: /nix/store/m9x3y8acqnm2jvn2papmq6bl5z1qpfck-lix-2.92.0/share
## Describe the bug When running `nix flake show` on a flake that contains attributes that don't match what the Lix CLI tool expects to be in that place (eg. something that isn't a derivation in `devShells.${system}`), Lix prints an error message (eg. `error: expected a derivation`) and exits, without showing the rest of the outputs. This is annoying when I want to see other parts of the flake that Lix might be able to show with no problems, but it never prints them because an earlier failure in one path terminated the entire print. ## Steps To Reproduce Using the Lix 2.92.0 release flake as an example: 1. Run `nix flake show https://git.lix.systems/lix-project/lix/archive/2.92.0.tar.gz` 2. Observe that the command fails in the middle of printing `devShells` Example output (with some omissions for brevity: ``` https://git.lix.systems/api/v1/repos/lix-project/lix/archive/2837da71ec1588c1187d2e554719b15904a46c8b.tar.gz?narHash=sha256-CCKIAE84dzkrnlxJCKFyffAxP3yfsOAbdvydUGqq24g%3D&rev=2837da71ec1588c1187d2e554719b15904a46c8b ├───checks [...] ├───devShells │ ├───aarch64-darwin [...] │ ├───aarch64-linux [...] │ ├───i686-linux [...] │ ├───x86_64-darwin [...] │ └───x86_64-linux │ ├───aarch64-linux: development environment 'lix-shell-env-aarch64-unknown-linux-gnu' │ ├───armv6l-linux: development environment 'lix-shell-env-armv6l-unknown-linux-gnueabihf' │ ├───armv7l-linux: development environment 'lix-shell-env-armv7l-unknown-linux-gnueabihf' │ ├───default: development environment 'lix-shell-env' error: expected a derivation ``` ## Expected behavior I'd expect to see something like the following, where the error is logged for that one path and printing continues, eg. ``` │ ├───aarch64-linux: development environment 'lix-shell-env-aarch64-unknown-linux-gnu' │ ├───armv6l-linux: development environment 'lix-shell-env-armv6l-unknown-linux-gnueabihf' │ ├───armv7l-linux: development environment 'lix-shell-env-armv7l-unknown-linux-gnueabihf' │ ├───default: development environment 'lix-shell-env' │ ├───badPath: error: expected a derivation │ └───goodPath: development environment '...' ├───packages │ ├───aarch64-darwin [...] ``` ## `nix --version` output ``` nix (Lix, like Nix) 2.93.0-dev-6059cbb System type: x86_64-linux Additional system types: i686-linux, x86_64-v1-linux, x86_64-v2-linux, x86_64-v3-linux, x86_64-v4-linux Features: gc, signed-caches System configuration file: /etc/nix/nix.conf User configuration files: /home/ruby/.config/nix/nix.conf:/etc/xdg/nix/nix.conf:/home/ruby/.nix-profile/etc/xdg/nix/nix.conf:/nix/profile/etc/xdg/nix/nix.conf:/home/ruby/.local/state/nix/profile/etc/xdg/nix/nix.conf:/etc/profiles/per-user/ruby/etc/xdg/nix/nix.conf:/nix/var/nix/profiles/default/etc/xdg/nix/nix.conf:/run/current-system/sw/etc/xdg/nix/nix.conf Store directory: /nix/store State directory: /nix/var/nix Data directory: /nix/store/pnwhaxn8c3480k1jmq6aiyvnm75wbs8c-lix-2.93.0-dev-6059cbb/share ``` Also reproducible on most recent stable release: ``` nix (Lix, like Nix) 2.92.0 System type: x86_64-linux Additional system types: i686-linux, x86_64-v1-linux, x86_64-v2-linux, x86_64-v3-linux, x86_64-v4-linux Features: gc, signed-caches System configuration file: /etc/nix/nix.conf User configuration files: /home/ruby/.config/nix/nix.conf:/etc/xdg/nix/nix.conf:/home/ruby/.nix-profile/etc/xdg/nix/nix.conf:/nix/profile/etc/xdg/nix/nix.conf:/home/ruby/.local/state/nix/profile/etc/xdg/nix/nix.conf:/etc/profiles/per-user/ruby/etc/xdg/nix/nix.conf:/nix/var/nix/profiles/default/etc/xdg/nix/nix.conf:/run/current-system/sw/etc/xdg/nix/nix.conf Store directory: /nix/store State directory: /nix/var/nix Data directory: /nix/store/m9x3y8acqnm2jvn2papmq6bl5z1qpfck-lix-2.92.0/share ```
jade added this to the Error reporting project 2025-03-26 03:48:48 +00:00
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: lix-project/lix#768
No description provided.