NixOS config
Logseq relies on an older version of electron. Therefore, there are often problems with the Nix package. It is easier to use the AppImage and to identify possible alternatives. |
||
|---|---|---|
| hosts | ||
| modules | ||
| flake.lock | ||
| flake.nix | ||
| README.md | ||
NixOS Configuration Files wit Flakes, Home-Manager
Description
My NixOS configuration repository
Install a New Host
- Install NixOS with graphical ISO image (e.g. GNOME). During the installation the desktop environment can be choosen.
- Reboot into NixOS
- Edit
/etc/nixos/configuration.nixwith sudoedit- Change hostname
- Enable flakes by adding the line
nix.settings.experimental-features = [ "nix-command" "flakes" ]; - Install tmux, neovim, git by adding them to
environment.systemPackages = with pkgs; [
- Apply changes:
sudo nixos-rebuild switchand reboot - Clone NixOS config repository to /home/$USER/nixos:
cd $HOME
git clone https://git.plueschbit.de/jan/nixos-conf ~/nixos
- Add the new host to repository
- Create ~/nixos/hosts/$HOSTNAME
cp /etc/nixos/*.nix $HOSTNAME/.- Edit
~/nixos/flake.nixand add section for new host - Stage new config files:
git add flake.nix hosts/$HOSTNAME/*. Otherwise, nixos-rebuild will refuse to work with the files.
- Apply config:
sudo nixos-rebuild switch --flake ~/nixos/#<host>
Update Packages on a Host
Update of the file flake.nix:
cd ~/nixos
sudo nix flake update
Then, perform nixos rebuild:
sudo nixos-rebuild switch --flake ~/nixos/#<host>
Upgrading to a new NixOS channel
In flake.nix the channel is set to unstable. Therefore, there is no
need to upgrade the channel.
Garbage Collection
List all generations:
sudo nix-env --list-generations --profile /nix/var/nix/profiles/system
Keep e.g. the last five generations and perform garbage collection:
sudo nix-env --delete-generations +5 --profile /nix/var/nix/profiles/system
sudo nix-collect-garbage