Skip to content

Commit 0c928cd

Browse files
author
dplusplus
committed
Stop using nix-env -iA and add better instructions for Nix users
The pitfalls of using `nix-env -iA` are explained at https://stop-using-nix-env.privatevoid.net/. In summary, using `nix-env -iA` to install packages is bad because of potential name collisions, confusing conflicts with other packages installed by other means, and are generally against the declarative principles of Nix.
1 parent 3cf89fb commit 0c928cd

File tree

1 file changed

+28
-4
lines changed

1 file changed

+28
-4
lines changed

README.md

+28-4
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,35 @@ brew install --HEAD zk
6868

6969
### Nix
7070

71-
```sh
72-
# Run zk from Nix store without installing it:
71+
`zk` is available in nixpkgs and has a [Home Manager](https://github.com/nix-community/home-manager) module.
72+
73+
If you want to run `zk` without permanently installing it:
74+
```
7375
nix run nixpkgs#zk
74-
# Or, to install it permanently:
75-
nix-env -iA zk
76+
```
77+
78+
Or, if you want to create an ephemeral shell with `zk` available:
79+
```
80+
nix shell nixpkgs#zk
81+
```
82+
83+
To permanently install `zk` on NixOS at the system level, include `nixpkgs.zk` in `environment.systemPackages` in your system configuration (`/etc/nixos/configuration.nix` by default):
84+
```
85+
environment.systemPackages = [
86+
# Your other packages here
87+
nixpkgs.zk
88+
];
89+
90+
```
91+
92+
If you are using [Home Manager](https://github.com/nix-community/home-manager), instead of installing for all users on the system, you can permanently install and configure `zk` just for your user via the Home Manager module. Add this to your Home Manager configuration:
93+
```
94+
programs.zk.enable = true;
95+
96+
# Modify `${XDG_CONFIG_HOME}/zk/config.toml` through this attr
97+
programs.zk.settings = {
98+
# Add your own configuration settings for zk here
99+
};
76100
```
77101

78102
### Alpine Linux

0 commit comments

Comments
 (0)