Is it possible to set up KDE Discover to search the nix package database, and have an install button add to a config file?

Recently switched from Debian to NixOS, and I’ve been frustrated by how many steps it takes to install software with the configuration.nix file.

In Debian, it was like:

  1. Open up the Terminal,
  2. Type in sudo apt install [package name],

Or, when I don’t know the name of the program’s package, it’s

  1. Open up KDE Discover,
  2. Search the name of the program,
  3. Scroll to find the program,
  4. Click “Install”,

In NixOS, it seems to be like:

  1. Open up the nix package search webpage,
  2. Search the name of the program,
  3. Scroll to find the program,
  4. Click to find the syntax for adding the program to the configuration.nix (e.g. which package set it’s in),
  5. Open up configuration.nix,
  6. Type in the name of the program in configuration.nix,
  7. Open up the terminal,
  8. Type in sudo nixos-rebuild switch

I imagine it may be possible, though, to set up KDE discover so that it can search the nix package database, and let install button run a script to add a package to a text file that my configuration.nix then reads for a list of packages. Has anyone done something like this?

Hey,

Just to let you know you can search for packages in the cli using ‘nix search’ you can checkout this article here Search for Nix packages

Im not sure what you want exists, it may, but I haven’t heard of it.

On a different note, you could probably hack something together with a simple bash script that takes the name of the package and then inserts it into your packages/configuration file then rebuilds. Granted this approach won’t account for any additional configuration.

Bad idea, packages may need more config than just adding them to environment.systemPackages or whatnot.

Use the NixOS package search if you like, but first check the options search (or check man configuration.nix) to see if it has a dedicated .enable option.

1 Like

This concept was tried in GitHub - snowfallorg/nix-software-center: A simple gtk4/libadwaita software center to easily install and manage nix packages which hasn’t seen any upstream activity for nearly a year now, but you can feel free to install it and see it for yourself.

KDE Discover uses PackageKit - What is PackageKit? which does not support Nix and likely won’t in the future.

You can use nix profile install for an imperative way of installing and testing new packages without having to rebuild your configuration.

That was the bad idea I was implicitly referring to and didn’t want to mention.

Expect things to not-work as intended. NixOS modules (not packages! - usually) are what provide the config necessary for programs to work, which is the equivalent of packages on other distros. This gets asked constantly and the answer is always to search for options first.

1 Like

Hi
U have to have this mental model for nix, a declaratice config where all ur truth is in a single file and then you apply it.
to install a package u simply follow this:

  1. enter the package name u want in configuration.nix and sudo nixos-rebuild …

it’s a simple declarative mental model where u get to see the state of your system from a single place.

And there are few ways to search for packages,
websites:

  1. nixos search
  2. nixhub
  3. searchix
    etc etc

CLI way:
nh search # i use this occasinally btw
etc etc

I suggest for beginners go with official nixos search https://search.nixos.org/packages . It’ll show you more details like the binary names of rthe package etc.

The overall mental model is u don’t do changes to your system imperatively. You’ll soon understand how much useful this is.

It’s also the reason why most dont suggest you to install apps via nix profile or nix-env.

Again, options over packages. If you’re using k3b, partition-manager, etc you want to use the options.

2 Likes

exactly. Initially I couldn’t understand the poential between, but nowI always choose options over packages. NixOS and HM options are just cool :heart_eyes:

I’d also just like to add: How often do you install software that avoiding 4 clicks is worth the tradeoff of not being in full control?

Even beyond the fact that “installing” can mean many things, and therefore a one-button-does-it-all approach can never be correct (as @waffle8946 effectively says), surely in the process you also at least have to look around a little to see if the software does what you need, is reasonably maintained, how it integrates with your desktop, that the package looks reasonable and has an active maintainer, etc. The cost of a few bonus clicks is easily amortized by any due-diligence involved here.

It’s quite possible NixOS is simply not for you if you find this workflow overly cumbersome. The distro prioritizes user control and keeping a long-term understanding of your system; I think this is fundamentally incompatible with a workflow that would care for the relatively minor difference in effort here.

I’d go so far as to say that the average NixOS user probably prefers to add another 10 steps after this between commit hygiene, PRs, running tests, etc.

2 Likes

I suspect development has stalled also because it simply didn’t scale well for more complex packages that have module options attached to them. The Appstream component seems like a nightmare to scale since nixpkgs meta attributes don’t nearly provide enough metainfo to make it automatic.

I think there’s no getting around having to learn and understand Nix syntax to use NixOS and that’s fine in my opinion. Usually the barrier of entry to NixOS is the barrier to entry to people programming (which involves much more than the Nix code itself, research plays a huge part in it like discovering packages and options).

1 Like