I have been using nixOS on and off for most of 2023. I heard about it on Linux Unplugged and other Jupiter Broadcasting shows.
It is great fun!
I love having a single file, at this time, for defining the whole system and have all the syntax for it checked before building making it trivial but safe to experiement with different configurations.
I did have encryption on my drive and after changing desktop environments so much, the system seemed to come to a crawl so I nuked and paved with no encryption, raw dog, as they say.
Yolo.
nixOS repo #
My newbie nixOS configuration repo.
I know enough to be dangerous but never satisfied. I have used every major operating system and dabbled with a variety of distros and software in many forms but have never seriously invested much into the likes of Ansible or even dotfile management. I either start from scratch or copy things manually.
I think this is my chance to change that and maybe reach inner peace.
Goals #
I have been using nix and nixOS on and off for a few months. I am not a developer or system administrator but I asposue to be and want to do the following with this repo.
- Keep it simple
- Stick to stable
- Have some fun
Setup #
- Install nixOS
- Log in clone
nixos
git repo to hold folder. - Copy hardware config if needed.
cp /etc/nixos/hardware-configuration.nix ~/nixos/
- Build and switch to new config.
sudo nixos-rebuild switch -I nixos-config="~/nixos/configuration.nix"
Notes #
Swappiness #
Swappiness is usually set to 60 by default which is high and unnecessary with ample memory and solid state drives nowadays.
Check swappiness value with
cat /proc/sys/vm/swappiness
Add this to hardware-configuration.nix to set it to something else. My greybeard buddy said I could go as low as 1.
boot.kernel.sysctl = { "vm.swappiness" = 10;};
Zoxide #
I love this program to streamline filesystem navigation but if you simply install
the package, it requires an
initialization step and configuration in your .bashrc
, .zshrc
or similar and
that defeats the purpose of defining my system with nix.
To install, add the package in configuration.nix
pkgs.zoxide
To enable zoxide for interactive shells, add this to configuration.nix
programs.bash = {
interactiveShellInit = ''
eval "$(zoxide init bash)"
'';
};
Flatpak #
How to enable Flatpaks which is an alternate, non-declaritive way to install software.
I am using BitWarden and Obsidian at this time and the stable versions in nixpkgs were not working due to some outdated Electron libraries or something.
https://nixos.wiki/wiki/Flatpak https://flathub.org/setup/NixOS
Sometimes these are still useful so I can keep the rest of the system on a stable channel
$ flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo flathub.flatpakrepo
flatpak install flathub com.bitwarden.desktop
flatpak install flathub md.obsidian.Obsidian
Modularity #
I like the idea of a single configuration file but I also like Sway the tiling window manager and if I want to set that up, it would be nice to keep it in a separate file.
https://nixos.org/manual/nixos/unstable/#sec-modularity
Make something.nix and then import it in main configuration.nix file. Example:
make ~/nixos/sway.nix
and add the following
{ config, pkgs, ... }:
{
# Enable the Sway Window Manager
programs.sway = {
enable = true;
extraPackages = with pkgs; [
dmenu light
];
};
} {