Sorry about all the edits, but I’m trying to figure out how to make this post more legible…
I am new to NixOS and have been trying to install a couple of HP printers just using the NixOS standard plasma desktop environment.
When I try running:
nix run nixpkgs.hplipWithPlugin -c sudo hp-setup
it returns:
error: Package ‘hplip-3.19.12’ in /nix/var/nix/profiles/per-user/root/channels/nixos/pkgs/misc/drivers/hplip/default.nix:222 has an unfree license (‘unfree’), refusing to evaluate.
a) For nixos-rebuild you can set
{ nixpkgs.config.allowUnfree = true; }
in configuration.nix to override this.
b) For nix-env, nix-build, nix-shell or any other Nix command you can add
{ allowUnfree = true; }
to ~/.config/nixpkgs/config.nix.
(use ‘–show-trace’ to show detailed location information)
I checked /etc/nixos/configuration.nix and it has:
nixpkgs.config = {
allowUnfree = true;
};
I found a post that has addresses allowing Unfree packages
See the fifth line in my first post and then the error message I got starting a couple of lines down from there.
Maybe there was something wrong with how I typed it?
As I said, I do not think that nix run is influenced by the setting that you set in configuration.nix. Especially not if you run it as your user.
Also, using nix run is not installing for everyone through configuration.nix.
As far as I remember (can’t access my homes computer config right now, as I’m in the office), I just added pkgs.hplip to services.printing.drivers and then ran sudo hp-setup -i (or something like that for terminal mode) which then crashed shortly after printing the URL of the printer, which I then was able to use to configure CUPS through the web-UI in a imperative way.
If I don’t forget it, I’ll take a look at my config again when I’m back home and the kids are sleeping.
I figured out part of my problem.
I’m doing the setup in VirtualBox before I move it onto bare metal and I did not have the network set to bridged.
When I fixed that, I was able to use your advice to get one of the printers working through the web-UI.
The other printer (an HP LaserJet Pro P1102w) requires a proprietary plugin from HP. Grrr… That one always drives me nuts. LOL
I tried typing “hp-plugin -i” in the terminal emulator. Everything looked like it was going to work, but then it gave me an error:
Creating directory plugin_tmp
Verifying archive integrity… All good.
Uncompressing HPLIP 3.19.12 Plugin Self Extracting Archive…
/home/user/.hplip/hplip-3.19.12-plugin.run: ./hplip-plugin-install: /bin/bash: bad interpreter: No such file or directory
error: Python gobject/dbus may be not installed
Done.
pythonFull, python3Full, and dbus are all installed.
Also bash is installed;
which bash
returns:
/run/current-system/sw/bin/bash
I also tried installing
python38Packages.pygobject3
and
python27Packages.pygobject2
to no avail.
So I’m not sure what is missing.
Any additional thoughts would be more than welcome.
Thanks for helping.
Study the error carefully, it complains that a certain interpreter is not available, it seems as if the file complaining does come from a script in your homefolder, it is probably not managed by nix, but something else. Find that file and change the shebang to /usr/bin/env bash that should work as a quick fix.
Unfortunately, I cannot find any scripts in my home directory. It’s brand new and I haven’t put any in there yet. I even tried grepping for #! (both with and without escaping them). I don’t see anything executable either.
This is what the error says, so yes, due to the nesting its probably that hplib-plugin-install has been created/extracted from the hplip-3.19.12-plugin.run in which case I also have no clue how to continue, except for trying either an FHSenv (which though might fail to install the printer into the regular system) or temporarily creating /bin/bash linking to your profiles bash, which in itself is dirty enough to not do it…
Also its very likely that after installation again, other expected pathes might be hardcoded and lead to breakage later on…
Thanks for the response. I have that in mine as well. Unfortunately, I think the problem is with how HP wrote their proprietary plugin. I think they expected and hard-coded for a standard file hierarchy.
I’m a little confused on this too, I understand now the distinction between the (system-level) /etc/nixos/configuration.nix and the (user-level) config.nix, but on a fresh install, I don’t have a config.nixanywhere in my home folder. Is it supposed to be created manually?
For that matter I don’t have a ~/.config/nixpkgs directory either, nor a ~/.nixpkgs. The former of which was specified by the error from nix-env, and the latter I’m not sure where @meolar got that from?.. I’m still learning so might’ve missed something in the manual about the user-level setup, I’ve been mostly focusing on the system stuff so far.
Thank you, I discovered you do have to create it yourself. And that part is in the manual, my bad (there are too many “sections” of manuals, it’s really confusing)
And I figured I shouldn’t clog up the forum for a relatively simple question, doesn’t this one get bumped to the front page if I reply?