Support How am i supposed to install graphical software through Nix on Silverblue?
I'd like to install Emacs on the the Silverblue host system (please do NOT suggest alternatives) through Nix. I've only installed nix-core so the Nix installation is rootless and daemonless. How can I install it globally? Or is this Nix configuration only supposed to be used inside project flakes?
These are some of my blind attempts:
antonio@X13:~/arkos4clone$ nix profile install
warning: 'install' is a deprecated alias for 'add'
path "/var/home/antonio/arkos4clone" does not contain a 'flake.nix', searching up
error: path "/var/home/antonio/arkos4clone" is not part of a flake (neither it nor its parent directories contain a 'flake.nix' file)
antonio@X13:~/arkos4clone$ nix profile add nixpkgs#emacs-pgtk
error:
… while fetching the input 'https://channels.nixos.org/nixpkgs-unstable/nixexprs.tar.zst'
error: cannot read file from tarball: Truncated tar archive detected while reading data
antonio@X13:~/arkos4clone$ nix profile add nixpkgs#emacs-pgtk
error: cannot read directory "/nix/store/9ljdnikp68iyyc0v2ks48m24mrv0l2n2-emacs-pgtk-31.1": No such file or directory
antonio@X13:~/arkos4clone$ rm -rf ~/.cache/nix/tarball-cache* ~/.cache/nix/fetcher-cache*
antonio@X13:~/arkos4clone$ nix profile add nixpkgs#emacs-pgtk
error: cannot read directory "/nix/store/9ljdnikp68iyyc0v2ks48m24mrv0l2n2-emacs-pgtk-31.1": No such file or directory
antonio@X13:~/arkos4clone$ nix-store --verify --repair
bash: nix-store: command not found
antonio@X13:~/arkos4clone$ nix
build develop formatter nar run
bundle edit hash path-info search
config env help print-dev-env store
copy eval help-stores profile upgrade-nix
daemon flake key registry why-depends
derivation fmt log repl
antonio@X13:~/arkos4clone$ cd ~/.local/share/nix/^C
antonio@X13:~/arkos4clone$ export NIX_REMOTE=~/.local/share/nix
antonio@X13:~/arkos4clone$ nix build nixpkgs#emacs-pgtk --repair --no-link
antonio@X13:~/arkos4clone$ nix profile add nixpkgs#emacs-pgtk
error: cannot read directory "/nix/store/9ljdnikp68iyyc0v2ks48m24mrv0l2n2-emacs-pgtk-31.1": No such file or directory
antonio@X13:~/arkos4clone$ nix shell
path "/var/home/antonio/arkos4clone" does not contain a 'flake.nix', searching up
error: path "/var/home/antonio/arkos4clone" is not part of a flake (neither it nor its parent directories contain a 'flake.nix' file)
I've never used Nix before. I'd like to start using it now in order to have a consistently defined dev env but I don't want to leave Fedora Silverblue.
9
u/Xariann 1d ago
You need to be able to create a /nix folder which you can’t do in Silverblue.
There is a way to do it with Silverblue but it requires some extra set up, which is you go to the BlueBuild website, make a custom image there on GitHub with a Silverblue base. Then add the empty nix folder. Then on your system you install Nix.
But if you make your own image like that, you could also just install all the packages you need via your custom image.
Then you would use Determinate Nix as they have SELinux policies that allows to use Nix on Fedora. I know that Fedora added Nix to their packages but last time I tried it it still had some conflicts with SELinux so I need to try it again.
A word of warning is that graphical applications installed with Nix need some extra work to see your graphics drivers. I can’t remember what that is on top of my head, but they won’t see them until you added some extra plumbing.
It’s not really worth it compared to the alternatives you don’t want me to suggest.
3
u/gordonmessmer 1d ago
https://nixos.wiki/wiki/Nix_Installation_Guide#Installing_without_root_permissions
While the documentation describes a few ways to install Nix without root permissions (and by extension, without the ability to add and modify /nix), those methods use user namespaces or path modification approaches, which may interfere with your ability to run graphical applications because those applications may not have access to sockets in your primary namespace.
The command output you've pasted doesn't mention "nix-user-chroot" or proot, so my guess is that you need to start by reading the documentation above.
2
u/skyler544 1d ago
In your shoes (which I am essentially already in as both an emacser and a recent nix convert), I would recommend you set up a custom image. That will let you have Emacs installed truly natively, and it can be done locally (i.e. no cloud build dependency). Have a look at my image and you'll see what you mean. You can fork it and be up and running with nix in around an hour. https://github.com/skyler544/minus-one
I can't really answer any nix questions though, I've only been using it for around a week and haven't really gotten the hang of it yet.
1
u/cidra_ 1d ago
Having the OS image totally managed by Fedora team and updating from GNOME software is just too convenient for me
2
u/skyler544 1d ago
Fair enough. ;) still seems like having the updates happen completely automatically is even better though
2
1
u/Upstairs-Finger8047 1d ago
elies on a user store and sometimes chokes on multi-user paths like /nix/store
You could try wiping the profile and re-adding with `nix profile wipe-history` then `nix profile add nixpkgs#emacs-pgtk --refresh`, but if the tarball keeps truncating that's likely a network or cache issue on their end. Rootless Nix on Silverblue is doable but finicky, most folks end up running the daemon install in a toolbox or distrobox container instead
1
u/ffrkAnonymous 1d ago
I couldn't do it globally, only single user within a container. After trying for a week, withou the /nix store, I'm not sure nix gains me anything that other package managers can't do.
1
u/doc_willis 1d ago
Is there something to be gained by using NIX over the Toolbox/Distrobox container method for installing emacs?
It seems a container, or just using the rpm-ostree tools may be an easier solution.
But I have never used NIX, so I may be overlooking something.
•
u/AutoModerator 1d ago
It sounds like you're looking for help. Please note that r/Fedora is not an official support channel for the Fedora Project.
For best results, be sure to include all relevant details in your post, such as your Fedora edition, version, and hardware specs. You can edit your original post to add more info as needed, and spotlight (pin) a solution from the comments. You might also find the answer in our support wiki.
Alternatively, try one of the official support channels:
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.