r/NixOS•
licksmith

What do I need to do to fix this

Being painfully new to nixos, I am not sure how to resolve this error. I searched the forums, but didn't find what I need to get beyond this... i didn't post because I didn't want to create an account just now (its 3am)

I am trying to install a piece of software but get this error:

nix --extra-experimental-features nix-command run github:nix-gui/nix-gui --extra-experimental-features flakes

error: attribute 'defaultApp.x86_64-linux' should have type 'derivation'

​

Additionally, how to I make permanent the following switches

--extra-experimental-features nix-command

--extra-experimental-features flakes

(any other options you know I will need)

​

edit: minor edit

Posted Sep 1, 2022, 9:56 AM UTC · edited

510
overwritten-entry•

Error message tells you that it can only run derivations, and defaultApp.x86_64-linux is not one, you can run outputs of a flake(typically derivations) by specifying path with #something.something appended to the flake url/path, so in your case $ nix run github:nix-gui/nix-gui#nix-gui. You can check what outputs does flake provide here. Showing outputs without locating the file itself is done with $ nix flake show github:nix-gui/nix-gui(nix does some magic here when choosing what output to run and you should omit things like cpu architecture)

Second issue is fixed with putting nix.settings.experimental-features = [ "nix-command" "flakes" ]; in your configuration.nix file(https://nixos.wiki/wiki/Flakes#NixOS)

Generally in the era of flakes it is good idea to read https://nixos.wiki/wiki/Flakes, the whole page.

Also some notes:

  1. Please make a more descriptive titles, generic ask for help just doesn't cut it. "Can't run nix-gui" "Nix run fails to run nix-gui" would be a better choice(though i am bad at naming things too)
  2. It is great idea to enclose logs/code into markdown's code blocks(text between backticks) `text` is rendered as text and block

```

code

code

```

is

code
code

Edit: Fixed wrong example of enabling flakes
Edit 2: verified $ nix run nix run github:nix-gui/nix-gui#nix-gui working. However now it spits this text, guess its wayland issue

qt.qpa.plugin: Could not find the Qt platform plugin "wayland" in ""
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, xcb.
6
[deleted]•

[deleted]

2
[deleted]•

[deleted]

2
SAI_Peregrinus•

Note that triple backticks are a "new reddit" thing (it's in CommonMark, but Reddit didn't initially use CommonMark and still doesn't support all features) and several mobile clients can't render them. Indenting code by 4 spaces is the backwards-compatible way.

1
michzappa•

You are running a newer version of nix than the flake was made with. they changed how packages outputs work at some point. I think you can run nix build with the flake and then execute the result/bin/xxx

2
[deleted]•

[deleted]

-1
[deleted]•

[deleted]

-2
lourkeur•

nix run github:nix-gui/nix-gui#nix-gui appears to work. Something odd between what the flake provides and what Nix expects.

how to I make permanent the following switches

put them in /etc/nix/nix.conf:

extra-experimental-features = nix-command  flakes
2
[deleted]•

[deleted]

-1
PrimaMateria•

I hate people deleting their questions once they solve their problems.

1
[deleted]•

[deleted]

-1
[deleted]•

[deleted]

-1
licksmithOP•

You know you could help a little

I did ask a second question which you ignored.

-6
[deleted]•

[deleted]

-2