Skip to content

Commit a0afbc5

Browse files
Update instructions
1 parent 937f534 commit a0afbc5

1 file changed

Lines changed: 172 additions & 6 deletions

File tree

Guides/NixOS/Install.md

Lines changed: 172 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,7 @@ chmod -R 700 /mnt/boot
116116
### BTRFS Subvolumes
117117

118118
```
119-
btrfs subvolume create /mnt/root
120-
121-
btrfs subvolume create /mnt/usr
119+
btrfs subvolume create /mnt/nix
122120
123121
btrfs subvolume create /mnt/etc
124122
@@ -151,11 +149,159 @@ Generate a default config
151149
nixos-generate-config --root /mnt
152150
```
153151

154-
Edit the config and add the parts from "kde.nix".
152+
### 2.1 Main configuration.nix
153+
Edit the main config file
154+
155+
```
156+
cd /mnt/etc/nixos
157+
mkdir configuration
158+
nano configuration.nix
159+
```
160+
161+
Replace the part at the top, loading the hardware configuration, with this:
162+
163+
```
164+
{
165+
imports =
166+
[
167+
./hardware-configuration.nix
168+
./configuration/packages.nix
169+
./configuration/kde-plasma.nix
170+
# ./configuration/unstable-packages.nix
171+
];
172+
...
173+
```
174+
175+
Apart from that, change as little as possible in that file.
176+
177+
### 2.2 Specific config files
178+
179+
Separate out other config snippets to keep it clean.
180+
181+
In this example, additional packages and KDE Plasma are separated out.
155182

183+
#### 2.2.1 KDE Plasma Config File
184+
185+
```
186+
nano configuration/kde-plasma.nix
156187
```
157-
nano /mnt/etc/nixos/configuration.nix
188+
189+
Add something like this here
190+
191+
```
192+
{ config, lib, pkgs, ... }:
193+
194+
{
195+
196+
# KDE Plasma 6 and SDDM
197+
services.displayManager.sddm.enable = true ;
198+
services.desktopManager.plasma6.enable = true ;
199+
200+
# KDE Plasma in Wayland
201+
services.displayManager.defaultSession = "plasma" ;
202+
203+
# SDDM in Wayland
204+
services.displayManager.sddm.wayland.enable = true ;
205+
206+
# KDE Plasma
207+
environment.plasma6.excludePackages = with pkgs.kdePackages; [
208+
oxygen
209+
elisa
210+
xwaylandvideobridge
211+
];
212+
213+
# KDE Partitionmanager
214+
programs.partition-manager.enable = true;
215+
216+
# programs.kdeconnect.package = true;
217+
programs.kdeconnect.enable = true;
218+
}
219+
```
220+
221+
#### 2.2.2 Packages
222+
223+
```
224+
nano configuration/packgages.nix
225+
```
226+
227+
example:
228+
158229
```
230+
{ config, lib, pkgs, ... }:
231+
232+
{
233+
programs.firefox.enable = true;
234+
235+
# syncthing
236+
services.syncthing.enable = true;
237+
238+
# localsend
239+
programs.localsend.enable = true;
240+
241+
# List packages installed in system profile. To search, run:
242+
# $ nix search wget
243+
environment.systemPackages = with pkgs; [
244+
wget
245+
aria2
246+
curl
247+
git
248+
nano
249+
htop
250+
btop
251+
powertop
252+
cosmic-term
253+
kate
254+
haruna
255+
];
256+
}
257+
```
258+
259+
#### 2.2.3 Unstable Packages
260+
This does not work yet, unsure if you can add the unstable branch at installation.
261+
262+
NixOS is stable by default, with updates every 6 months. Meanwhile, the packages are actually updated very frequently, and the `unstable` branch allows to use these. Switching to it entirely is often recommended, but can introduce instability, the packages are about as new as on Arch Linux.
263+
264+
So an alternative is to mix stable and unstable. Note that a ton of dependencies will be duplicated, which slows down updates and increases storage size.
265+
266+
Example:
267+
268+
```
269+
{ config, lib, pkgs, ... }:
270+
271+
let
272+
unst = import <nixos-unstable> {};
273+
in
274+
{
275+
# Mullvad
276+
services.mullvad-vpn.package = unst.mullvad-vpn;
277+
services.mullvad-vpn.enable = true ;
278+
279+
# Fish Shell
280+
programs.fish.package = unst.fish;
281+
programs.fish.enable = true;
282+
programs.fish.vendor.functions.enable = true;
283+
programs.fish.vendor.completions.enable = true;
284+
programs.fish.vendor.config.enable = true;
285+
286+
# Flatpak
287+
services.flatpak.package = unst.flatpak;
288+
services.flatpak.enable = true;
289+
}
290+
```
291+
292+
To enable this (after installation), add the unstable channel and update the channels.
293+
294+
```
295+
sudo nix-channel --add https://channels.nixos.org/nixos-unstable nixos-unstable
296+
sudo nix-channel --update
297+
298+
# then remove the comment in the main configuration.nix
299+
# now rebuild the system
300+
301+
sudo nixos-rebuild switch
302+
```
303+
304+
### 2.3 Hardware Config
159305

160306
enable bluetooth
161307

@@ -184,4 +330,24 @@ passwd user
184330

185331
## 5. Test the system
186332

187-
See what packages are missing, add them to the packages section
333+
See what packages are missing, add them to the config files.
334+
335+
## 6. Stable vs. Unstable
336+
337+
If you want to replace the stable channel with the unstable one, override the default `nixos` channel.
338+
339+
```
340+
sudo nix-channel --add https://channels.nixos.org/nixos-unstable nixos
341+
sudo nix-channel --update
342+
sudo nixos-rebuild switch
343+
```
344+
345+
This will rebuild the OS and swap out the packages with the unstable ones.
346+
347+
To revert, you need to add a point release channel, currently 24.11
348+
349+
```
350+
sudo nix-channel --add https://channels.nixos.org/nixos-24.11 nixos
351+
sudo nix-channel --update
352+
sudo nixos-rebuild switch
353+
```

0 commit comments

Comments
 (0)