So, I installed nix operating system, upon using it as a package manager for some time in my fedora installation.
Installation
I used the Graphical ISO image to install the nix using the graphical installer but installed with no desktop. I was dropped in to the TTY and the fun began. I completely setup the distribution using just the /etc/nixos/configuration.nix
though there are other methods like home manager, nix flakes with different nix commands like nix-shell that helps to create a nix development environment, developing in a nix environment makes it easier to keep track of what the dev is installing for the source to build correctly.
Setup
Auto Congifured
The part which the installation configured itself:
- User Creation
I added thedocker
value in extra group because I plan to use distrobox in the OS andtrash-cli
for the user packages.
# Define a user account. Don't forget to set a password with ‘passwd’.
users.users.scientiac = {
isNormalUser = true;
description = "Scientiac";
extraGroups = [ "networkmanager" "wheel" "docker" ];
packages = with pkgs; [
trash-cli
];
};
- Hardware Configuration
Includes the/etc/nixos/hardware-configuration.nix
file which does the system hardware configuration.
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
];
- Bootloader
Enables systemd-boot and I have added theconsoleMode
option to bemax
to get the max resolution of my bootloader.
# Bootloader.
boot.loader.systemd-boot.enable = true;
# To enable full resolution and efi.
boot.loader.systemd-boot.consoleMode = "max";
boot.loader.efi.canTouchEfiVariables = true;
- Version Definition
Defines the system version that the OS is in.
system.stateVersion = "23.05";
Customizations
The system I configured at it’s minimal stage:
- SSH
Enables thessh
daemon.
# Enable the OpenSSH daemon.
services.openssh.enable = true;
- X11 for Display Managers and Xwayland
Sets the keymap layout to us and enables x11 for login managers.
# Configure keymap in X11
services.xserver = {
enable = true;
layout = "us";
xkbVariant = "";
};
- Unfree Packages
Allows unfree packages.
# Allow unfree packages
nixpkgs.config.allowUnfree = true;
- Internationalization
Sets the locale and other settings toen_US.UTF-8
and enabling fcitx form17n
that helps to type in other languages.
# Select internationalisation properties.
i18n.defaultLocale = "en_US.UTF-8";
i18n.extraLocaleSettings = {
LC_ADDRESS = "en_US.UTF-8";
LC_IDENTIFICATION = "en_US.UTF-8";
LC_MEASUREMENT = "en_US.UTF-8";
LC_MONETARY = "en_US.UTF-8";
LC_NAME = "en_US.UTF-8";
LC_NUMERIC = "en_US.UTF-8";
LC_PAPER = "en_US.UTF-8";
LC_TELEPHONE = "en_US.UTF-8";
LC_TIME = "en_US.UTF-8";
};
# To use the keyboard for multiple languages.
i18n.inputMethod = {
enabled = "fcitx5";
fcitx5.addons = with pkgs; [
fcitx5-m17n
fcitx5-gtk
];
};
- Neovim
Enables neovim and sets it up as the default editor.
# Enable Neovim
programs.neovim.enable = true;
# Setting Neovim as the system default editor.
programs.neovim.defaultEditor = true;
- Sway
Enables sway and it’s wrapper features.
# Enabling Sway
programs.sway = {
enable = true;
wrapperFeatures.gtk = true;
};
- Login Manager (Display Manager)
Enables thegreetdm
login manager and using theregreet
greeter by configuring fonts and darkmode.
# Enabling greetdm Login Manager
services.greetd.enable = true;
programs.regreet = {
enable = true;
settings = {
GTK = {
application_prefer_dark_theme = true;
font_name = "FantasqueSansMNerdFont 12";
};
};
};
- Pipewire
Enables pipewire, pipewire-pulse and alsa for audio.
# Setup Pipewire
services.pipewire = {
enable = true;
alsa.enable = true;
pulse.enable = true;
};
- Portals
Enables xdg-desktop portals and dbus.
# Enable Portals
services.dbus.enable = true;
xdg.portal = {
enable = true;
wlr.enable = true;
# gtk portal needed to make gtk apps happy
extraPortals = [ pkgs.xdg-desktop-portal-gtk ];
};
- Upower
Enables the upower daemon for battery monitoring and sets the low and critical percentage values.
# Enable Upower daemon
services.upower = {
enable = true;
percentageLow = 20;
percentageCritical = 10;
};
- gvfs
Enables trash and other similar protocols supported by gvfs.
# Enable trash protocol
services.gvfs.enable = true;
- Fonts
Enables font directory, sets the default font and installs specified font packages.
fonts = {
fontDir.enable = true;
fontconfig = {
enable = true;
defaultFonts = {
monospace = ["FantasqueSansMNerdFont"];
};
};
fonts = with pkgs; [
(nerdfonts.override {fonts = ["Meslo" "FantasqueSansMono" "Mononoki" ];})
lohit-fonts.nepali
lohit-fonts.devanagari
annapurna-sil
noto-fonts
noto-fonts-cjk
noto-fonts-emoji
liberation_ttf
];
};
- Packages
Installs the specified packages for a minimal sway desktop.
# List of packages installed in system profile. To search, run:
# $ nix search wget
environment.systemPackages = with pkgs; [
# terminal
poweralertd
coreutils-full
starship
jq
gnome.gedit
libnotify
swaylock-effects
cava
swayidle
mako
wdisplays
neovim
wget
git
neofetch
grim
slurp
brightnessctl
pulseaudio
xdg-utils
btrfs-progs
glib
gtk3
wayland
wl-clipboard
killall
# browsers and essentials
firefox-devedition
brave
chromium
gnome.nautilus
alacritty
# icons
gnome3.adwaita-icon-theme
# for wm
rofi-wayland
waybar
# For neovim
lazygit
fd
nodejs
lf
fzf
ripgrep
python3
gnumake
libgccjit
binutils
gnat
glibc
# For Rust
rustup
# ROS
distrobox
# Brain Management
obsidian
# Office
libreoffice-fresh
# Arduino
arduino-cli
];
- Podman
Enables podman for distrobox and sets required configurations to use containerized ros and other packages not in the nixos repos.
# Enabling Podman
virtualisation = {
podman = {
enable = true;
# Create a `docker` alias for podman, to use it as a drop-in replacement
dockerCompat = true;
# Required for containers under podman-compose to be able to talk to each other.
defaultNetwork.settings.dns_enabled = true;
};
};
- Opengl
Enables opengl with Dri support.
hardware.opengl = {
enable = true;
driSupport = true;
driSupport32Bit = true;
};
This custom configuration installs and enables services needed for a minimal sway desktop without any customization and enabling desktop requirements like notification daemons and bars.