Skip to content

Instantly share code, notes, and snippets.

@dmitmel
Last active August 26, 2025 23:21
Show Gist options
  • Save dmitmel/b8259d578c28294740f43437e8bd9b93 to your computer and use it in GitHub Desktop.
Save dmitmel/b8259d578c28294740f43437e8bd9b93 to your computer and use it in GitHub Desktop.
My first ever NixOS configuration, written back at the start of 2019.
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).
{ config, pkgs, lib, ... }:
{
imports = [
# Include the results of the hardware scan.
./hardware-configuration.nix
];
# Use the systemd-boot EFI boot loader.
boot = {
loader = {
systemd-boot.enable = true;
efi.canTouchEfiVariables = true;
};
earlyVconsoleSetup = true;
postBootCommands = ''
${pkgs.kbd}/bin/setvtrgb - <<EOF
45,242,153,255,102,204,102,211,116,242,153,255,102,204,102,242
45,119,204,204,153,153,204,208,115,119,204,204,153,153,204,240
45,122,153,102,204,204,204,200,105,122,153,102,204,204,204,236
EOF
'';
};
hardware.cpu.intel.updateMicrocode = true;
fileSystems."/mnt/Arch" = {
device = "/dev/disk/by-partlabel/Arch";
fsType = "ext4";
};
networking.hostName = "pelmeshka-computer2-nixos";
networking.networkmanager.enable = true;
services.avahi = {
enable = true;
nssmdns = true;
publish = {
enable = true;
addresses = true;
};
};
# The global useDHCP flag is deprecated, therefore explicitly set to false here.
# Per-interface useDHCP will be mandatory in the future, so this generated config
# replicates the default behaviour.
networking.useDHCP = false;
networking.interfaces.enp8s0.useDHCP = true;
networking.interfaces.wlp9s0.useDHCP = true;
i18n = {
consoleFont = "Lat2-Terminus16";
consoleKeyMap = "us";
defaultLocale = "en_US.UTF-8";
extraLocaleSettings = {
LC_COLLATE = "C";
LC_TIME = "en_GB.UTF-8";
LC_MESSAGES = "en_US.UTF-8";
LC_IDENTIFICATION = "uk_UA.UTF-8";
LC_ADDRESS = "uk_UA.UTF-8";
LC_MONETARY = "uk_UA.UTF-8";
LC_MEASUREMENT = "uk_UA.UTF-8";
LC_NAME = "ru_RU.UTF-8";
LC_NUMERIC = "uk_UA.UTF-8";
LC_PAPER = "uk_UA.UTF-8";
LC_TELEPHONE = "uk_UA.UTF-8";
};
};
security.sudo.extraConfig = ''
# Show asterisks when typing passwords.
Defaults pwfeedback
# Disable launching arbitrary editors from the EDITOR, VISUAL and SUDO_EDITOR
# variables when using visudo because this is a potential security hole.
Defaults !env_editor
# Whitelist of editors which visudo is allowed to run.
Defaults editor=${pkgs.neovim}/bin/nvim:${pkgs.vim}/bin/vim:${pkgs.nano}/bin/nano
# Pass-through the editor environment variables so that visudo will be able to
# see them.
Defaults env_keep+="EDITOR VISUAL SUDO_EDITOR"
'';
time.timeZone = "Europe/Kiev";
# List packages installed in system profile. To search, run:
# $ nix search wget
environment.systemPackages = with pkgs; [
python
(python3.withPackages (pypkgs: with pypkgs; [
psutil
distro
colorama
]))
# editor
vim
neovim
# desktop
xdg-user-dirs
# utilities
wget
htop
cmatrix
zsh
git
file
];
# Some programs need SUID wrappers, can be configured further or are
# started in user sessions.
# programs.mtr.enable = true;
# programs.gnupg.agent = { enable = true; enableSSHSupport = true; };
# List services that you want to enable:
services.openssh = {
enable = true;
passwordAuthentication = false;
};
# Open ports in the firewall.
# networking.firewall.allowedTCPPorts = [ ... ];
# networking.firewall.allowedUDPPorts = [ ... ];
# Or disable the firewall altogether.
networking.firewall.enable = false;
# Enable CUPS to print documents.
# services.printing.enable = true;
# Enable sound.
sound.enable = true;
hardware.pulseaudio.enable = true;
services.xserver = {
enable = true;
xkbModel = "pc104";
layout = "us,ru,ua";
xkbOptions = "grp:rctrl_rshift_toggle";
xkbVariant = ",,winkeys";
libinput = {
enable = true;
};
displayManager.lightdm = {
enable = true;
greeters.gtk = {
theme.name = "Adwaita-dark";
# iconTheme.name = "MAZE-Faeza";
iconTheme.name = "Adwaita";
cursorTheme.name = "Adwaita";
cursorTheme.size = 16;
clock-format = "%a %b %d, %H:%M:%S";
indicators = [ "~host" "~spacer" "~clock" "~spacer" "~language" "~session" "~a11y" "~power" ];
extraConfig = ''
laptop = true
font-name = sans-serif 14
screensaver-timeout = 60
'';
};
};
desktopManager = {
xfce.enable = true;
xterm.enable = false;
default = "xfce";
};
};
programs.zsh = {
enable = true;
# shellAliases = builtins.trace config.environment.shellAliases { l = null; ll = null; ls = null; };
shellAliases = lib.mkForce {};
promptInit = "";
setOptions = [];
enableCompletion = false;
};
# Define a user account. Don't forget to set a password with ‘passwd’.
users.users.dmitmel = {
isNormalUser = true;
extraGroups = [
"wheel" # Enable ‘sudo’ for the user.
"networkmanager"
];
shell = pkgs.zsh;
};
# This value determines the NixOS release with which your system is to be
# compatible, in order to avoid breaking some software such as database
# servers. You should change this only after NixOS release notes say you
# should.
system.stateVersion = "19.09"; # Did you read the comment?
}
# Do not modify this file! It was generated by ‘nixos-generate-config’
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, ... }:
{
imports =
[ <nixpkgs/nixos/modules/installer/scan/not-detected.nix>
];
boot.initrd.availableKernelModules = [ "xhci_pci" "ehci_pci" "ahci" "usb_storage" "sd_mod" "sr_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/497317b3-90a3-46a5-b943-5adbc526c226";
fsType = "ext4";
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/BF8C-CDAF";
fsType = "vfat";
};
swapDevices =
[ { device = "/dev/disk/by-uuid/54b918ae-732f-42dd-8c97-3f702d84e687"; }
];
nix.maxJobs = lib.mkDefault 8;
powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment