After years of using nixpkgs on ubuntu and nixos in virtual machine, I finally made the switch to using nixos as the primary OS on the home laptop. As the home laptop is shared, I used a dual boot configuration with Windows10 along side NixOS. Each OS is installed to a separate hard disk. The installation process was pleasantly uneventful.
The WiFi card was autodetected. WiFi configuration was easy once I
discovered nmcli
.
# /etc/nixos/configuration.nix
networking.networkmanager.enable = true; # Enable network manager
$ nmcli d wifi connect vmandela --ask
With grub os prober enabled, windows 10 showed up automatically in the bootloader menu.
# /etc/nixos/configuration.nix
# Use the systemd-boot EFI boot loader.
boot.loader = {
systemd-boot.enable = true;
efi.canTouchEfiVariables = true;
grub = {
enable = true;
devices = [ "nodev" ];
efiSupport = true;
useOSProber = true;
};
};
Windows 10 and NixOS treat the hardware clock differently. Windows 10 treats the hardware clock as local time while NixOS treats it as UTC. To resolve this difference, I had to switch NixOS to treat hardware clock as local time.
# /etc/nixos/configuration.nix
# Set your time zone.
time.timeZone = "Asia/Kolkata";
# Use hardware clock in local time instead of UTC
# This is required for compatibility with windows
time.hardwareClockInLocalTime = true;
Steam worked out of the box following the instructions in the Nixpkgs Manual.
# /etc/nixos/configuration.nix
# Required for steam
hardware.pulseaudio.support32Bit = true;
hardware.opengl.driSupport32Bit = true;
Setting up NGINX required a little document hunting. I use NGINX for checking out my blog locally before pushing it to github. My usecase fell into the so simple it is undocumented category.
# /etc/nixos/configuration.nix
# Enable NGINX
services.nginx = {
enable = true;
virtualHosts."localhost" = {
root = "/home/vmandela/code/gh-blog/_site";
};
};
Power management and monitoring is done using tlp
and upower
.
# For thinkpad
services.tlp.enable = true;
# Battery power management
services.upower.enable = true;
Getting the user environment setup was done by reusing dotfiles from the previous machine and using Nix Home Manager