This commit is contained in:
Tastatur 2024-03-25 11:07:52 +01:00
parent cfb9ce3ac2
commit 0a6e3c8871

View file

@ -1,4 +1,4 @@
# Nix (WIP - don't follow)
# Nix (WIP - don't follow yet)
The *Nix package manager* is a package manager which allows for user independent packages and a whole lot more (although it's not necessarily minimal). To set it up install it's package and activate it's service:
@ -12,7 +12,7 @@ The *Nix package manager* is a package manager which allows for user independent
> (The `nix` package is only available in the `edge` and `apk-ample` repositories)
And add this line to `/etc/nix/nix.conf` to globally enable some features which will be necessary later:
And add this line to `/etc/nix/nix.conf` to globally enable some features so they can be used later if necessary:
```
experimental-features = nix-command flakes
@ -24,20 +24,28 @@ Don't forget to add your user to the nix group:
# adduser <username> nix
```
### Channels
For `nix` to be able to install packages it is necessary to add a few channels:
```
$ nix-channel --add https://nixos.org/channels/nixos-23.11 nixos
$ nix-channel --add https://nixos.org/channels/nixpkgs-unstable nixpkgs
$ nix-channel --update
```
## Usage
Nix can be used to manage your `$HOME` with `home-manager` and `flakes`. ([Here a link explaining it all](https://juliu.is/tidying-your-home-with-nix/))
Now that Nix is up and running utilize the `flake` that comes with the [config files](https://docs.bijl.us/alpine-desktop-setup/post-install/config-files/) to set up our home for us. But before initialising `nix` make sure that you set the correct `<username>` in both `flake.nix` and `home.nix` which are located in `~/.config/home-manager`. Then after changing those simply run this command from that same directory:
Nix can be used to manage your `$HOME` with `home-manager`. First install `home-manager` through:
```
$ nix run . switch
$ nix-env -iA nixos.home-manager
```
This should have installed `nixpkgs-unstable` and `home-manager`. Verify this with:
Now that Nix is up and running utilize the `home.nix` that comes with the [config files](https://docs.bijl.us/alpine-desktop-setup/post-install/config-files/) to set up our home for us. But before initialising `nix` make sure that you set the correct `<username>` in `home.nix` which is located in `~/.config/home-manager`. Then after changing that simply run this command:
```
$ home-manager --version
$ home-manager switch
```
And thanks to `home-manager` we can easily set up and manage an entire graphical enviroment with all the necessary packages in one go.
@ -50,12 +58,11 @@ $ nix-env -iA nixpkgs.<package>
You can also test a package before installing it with `nix-shell -p <program>`
To update your system, in `~/.config/home-manager` run:
```
$ nix flake update
```
### Nix-Bubblewrap
### NixGL
`nixGL` will be necessary to be able to run graphical programs which are installed through `nix`. Add it's channel and install it with:
```
$ nix-channel --add https://github.com/nix-community/nixGL/archive/main.tar.gz nixgl && nix-channel --update
$ nix-env -iA nixgl.auto.nixGLDefault nixgl.VulkanIntel
```