Since there was a dicussion about the usage of all the CLI tools here on Discourse, I figured it would be cool to have a rough CLI tool that incorporated some of those ideas:
It is a tool that supports the following commands:
pocnix local install hello
pocnix user install hello
sudo pocnix system install hello
It uses a pkgs.json
file to define which packages should be installed in an environment. This file needs to be referenced from default.nix
, home.nix
and/or configuration.nix
.
To help set up a correct environment, you can use the following commands to set up the Nix files correctly:
pocnix local init
pocnix user init
pocnix system init
It will create Nix files if they do not yet exist and otherwise give an example how these files should look like.
It is very rough. Made it this evening. The intention is not to create a good CLI alternative to Nix, but to spark some discussion on what the Nix CLI could be doing.
The current suite of CLI tools are quite varying in their usage and there are different workflows involved to do seemingly similar things. Sometimes editing files and switching, sometimes ad-hoc installations using nix-env
. In addition, quite a few NixOS users have switched from using nix-env
to using home-manager
or similar solutions.
Lastly, nixpkgs pinning should (imo) be a default for most usages of Nix, but this is often still a bit of a hassle. nix-channel is convenient, but its usage goes against the philosophy of Nix (reproducability).
The user interface is especially important when showing off Nix to (potential) new users. It is hard to sell, as its usage is far from convenient compared to language-specific package managers with which most people are quite familiar. Those tools nowadays all have pinning by default. Installing packages is easy, while still easy to share with others over version control.
Anyway, let me know what’s on your mind in this regard!