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:

  1. User Creation
    I added the docker value in extra group because I plan to use distrobox in the OS and trash-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
    ];
  };
  1. 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
    ];
  1. Bootloader
    Enables systemd-boot and I have added the consoleMode option to be max 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;
  1. 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:

  1. SSH
    Enables the ssh daemon.
# Enable the OpenSSH daemon.
  services.openssh.enable = true;
  1. 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 = "";
  };
  1. Unfree Packages
    Allows unfree packages.
# Allow unfree packages
  nixpkgs.config.allowUnfree = true;
  1. Internationalization
    Sets the locale and other settings to en_US.UTF-8 and enabling fcitx for m17n 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
    ];
  };
  1. 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;
  1. Sway
    Enables sway and it’s wrapper features.
# Enabling Sway
  programs.sway = {
    enable = true;
    wrapperFeatures.gtk = true;
  };
  1. Login Manager (Display Manager)
    Enables the greetdm login manager and using the regreet 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";
      };
    };
  };
  1. Pipewire
    Enables pipewire, pipewire-pulse and alsa for audio.
# Setup Pipewire
  services.pipewire = {
    enable = true;
    alsa.enable = true;
    pulse.enable = true;
  };
  1. 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 ];
  };
  1. 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;
  };
  1. gvfs
    Enables trash and other similar protocols supported by gvfs.
# Enable trash protocol
  services.gvfs.enable = true;
  1. 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
    ];
  };
  1. 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
      ];
  1. 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;
    };
  };
  1. 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.