nixos-dots

nixos dots
git clone git://popovic.xyz/nixos-dots.git
Log | Files | Refs

commit d7bde7fb846f5f0b97c9a4d21c44863a6e0b7e02
parent 1d5ca44ee7ca7ab1be6d23944f1b484c3491a29d
Author: Milutin Popovic <milutin@popovic.xyz>
Date:   Wed, 25 Mar 2026 09:45:52 +0000

add niri

Diffstat:
Amachines/frame/configuration.nix | 220+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Amachines/frame/hardware.nix | 42++++++++++++++++++++++++++++++++++++++++++
Amachines/frame/harware-unencrypted.nix | 34++++++++++++++++++++++++++++++++++
Amachines/mac/configuration.nix | 311+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Amachines/server/configuration.nix | 128+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Amachines/server/disk.nix | 40++++++++++++++++++++++++++++++++++++++++
Amachines/server/hardware.nix | 16++++++++++++++++
Amachines/vm/disk.nix | 40++++++++++++++++++++++++++++++++++++++++
Amachines/vm/hardware.nix | 16++++++++++++++++
Mmodules/packages.nix | 8++++++++
Musers/mika.nix | 15+++++++++++++++
11 files changed, 870 insertions(+), 0 deletions(-)

diff --git a/machines/frame/configuration.nix b/machines/frame/configuration.nix @@ -0,0 +1,220 @@ +{ + pkgs, + lib, + hostName, + isDarwin, + ... +}: +{ + imports = [ + ../../users/root.nix + ../../modules/nix_settings.nix + ../../modules/nm.nix + ]; + + sops.defaultSopsFile = ../../secrets.yaml; + sops.defaultSopsFormat = "yaml"; + sops.age.keyFile = "/home/mika/.config/sops/age/keys.txt"; + + system.stateVersion = "25.11"; + + # vm + virtualisation.vmVariant = { + virtualisation = { + diskSize = 50 * 1028; # 50 GB + memorySize = 16 * 1028; # 16 GB + cores = 6; + resolution = { + x = 1600; + y = 900; + }; + qemu.options = [ + "-enable-kvm" + "-cpu host" + "-display gtk,zoom-to-fit=false" + "-vga virtio" + ]; + }; + }; + + virtualisation.docker = { + enable = true; + rootless = { + enable = true; + setSocketVariable = true; + }; + }; + + # boot + boot = { + loader = { + systemd-boot.enable = true; + efi.canTouchEfiVariables = true; + }; + kernelPackages = pkgs.linuxPackages_latest; + kernelParams = [ + "loglevel=3" + "nowatchdog" + "migrations=auto" + "amd_iommu=on" + "iommu=pt" + "rtc_cmos.use_acpi_alarm=1" + "usbcore.autosuspend=-1" + "pcie_port_pm=off" + "acpi.no_ec_wakup=1" + ]; + supportedFilesystems = [ + "btrfs" + "ext4" + "vfat" + "ntfs" + ]; + }; + + # netowrk + networking.hostName = "${hostName}"; + networking.wireless.enable = true; + networking.firewall.enable = false; + + # time/locale + i18n.defaultLocale = "en_US.UTF-8"; + + # programs + programs = { + nix-ld.enable = true; + zsh.enable = true; + dconf.enable = true; + gnupg.agent = { + enable = true; + enableSSHSupport = true; + }; + }; + + environment.variables = { + __ETC_ZSHRC_SOURCED = "1"; + __ETC_ZSHENV_SOURCED = "1"; + }; + + # users + users = { + users = { + mika = { + isNormalUser = true; + extraGroups = [ + "wheel" + "docker" + ]; + initialPassword = "123"; + shell = pkgs.zsh; + }; + root = { + shell = pkgs.zsh; + }; + }; + }; + security.sudo.wheelNeedsPassword = false; + + powerManagement.powertop.enable = true; + + # services + services = { + automatic-timezoned.enable = true; + gvfs.enable = true; + udisks2.enable = true; + upower.enable = true; + fwupd.enable = true; + openssh.enable = true; + tlp.enable = false; + power-profiles-daemon.enable = true; + pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + }; + xserver = { + enable = true; + serverFlagsSection = '' + Option "Xauth" "$XAUTHORITY" + ''; + displayManager.startx = { + enable = true; + }; + }; + getty.autologinUser = "mika"; + logind.settings.Login = { + SleepOperation = "suspend-then-hibernate"; + HandlePowerKey = "suspend-then-hibernate"; + HandleLidSwitch = "suspend-then-hibernate"; + HandlePowerKeyLongPress = "poweroff"; + }; + } + // lib.optionalAttrs (!isDarwin) { + gnome.gnome-keyring.enable = true; + libinput = { + enable = true; + touchpad.naturalScrolling = false; + }; + openssh = { + enable = true; + settings = { + PasswordAuthentication = false; + KbdInteractiveAuthentication = false; + PermitRootLogin = "no"; + AllowUsers = [ "myUser" ]; + }; + }; + }; + + systemd.sleep.settings.Sleep = { + HibernateDelaySec = "20m"; + }; + + systemd.network.links."10-wlan0" = { + matchConfig.MACAddress = "14:AC:60:29:82:AB"; + linkConfig.Name = "wlan0"; + }; + + # hardware + hardware.bluetooth.enable = true; + hardware.sensor.iio.enable = false; # disable light sensors + security.rtkit.enable = true; + + # packages + nixpkgs.config.allowUnfree = true; + environment.systemPackages = with pkgs; [ + neovim + wget + git + nix + curl + tree + coreutils + stdenv + dbus-broker + pciutils + util-linux + pstree + wireguard-tools + gnome.gvfs + ntfs3g + + upower + lm_sensors + acpilight + ]; + + # fonts + fonts.packages = with pkgs; [ + nerd-fonts.terminess-ttf + noto-fonts + noto-fonts-color-emoji + terminus_font + liberation_ttf + fira-code + fira-code-symbols + ubuntu-classic + corefonts + ]; + fonts.fontconfig.useEmbeddedBitmaps = true; +} diff --git a/machines/frame/hardware.nix b/machines/frame/hardware.nix @@ -0,0 +1,42 @@ +{ config, lib, modulesPath, ... }: + +{ + imports = + [ + (modulesPath + "/installer/scan/not-detected.nix") + ]; + + boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "thunderbolt" "usbhid" "usb_storage" ]; + boot.initrd.kernelModules = [ "dm-snapshot" "cryptd" ]; + boot.initrd.luks.devices."cryptroot".device = "/dev/disk/by-uuid/68d936fb-68be-4351-a557-874ef2d96efc"; # <-- + + boot.kernelModules = [ "kvm-amd" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { + device = "/dev/disk/by-uuid/adc85ee5-286c-44aa-9dfa-4580e59687dc"; + fsType = "ext4"; + }; + fileSystems."/home" = + { + device = "/dev/disk/by-uuid/2e36575d-3dc4-4760-9bc1-9bf055371805"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { + device = "/dev/disk/by-uuid/F656-048E"; + fsType = "vfat"; + options = [ "fmask=0022" "dmask=0022" ]; + }; + + swapDevices = + [ + { device = "/dev/disk/by-uuid/f1c0a91f-0460-4ba8-a414-f49c90dfa399"; } + ]; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.enableAllFirmware = true; + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/machines/frame/harware-unencrypted.nix b/machines/frame/harware-unencrypted.nix @@ -0,0 +1,34 @@ +{ config, lib, modulesPath, ... }: + +{ + imports = + [ + (modulesPath + "/installer/scan/not-detected.nix") + ]; + + boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "thunderbolt" "usbhid" "usb_storage" ]; + boot.initrd.kernelModules = [ "dm-snapshot" ]; + boot.kernelModules = [ "kvm-amd" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { + device = "/dev/disk/by-uuid/69e780cc-9ee1-4987-99eb-6c452ae66855"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { + device = "/dev/disk/by-uuid/7000-6EA2"; + fsType = "vfat"; + options = [ "fmask=0022" "dmask=0022" ]; + }; + + swapDevices = + [ + { device = "/dev/disk/by-uuid/fb532c05-67d1-4983-a518-e2616369b6ae"; } + ]; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/machines/mac/configuration.nix b/machines/mac/configuration.nix @@ -0,0 +1,311 @@ +{ + pkgs, + hostName, + systemName, + ... +}: +{ + # nix-darwin setup + nixpkgs.hostPlatform = systemName; + system.stateVersion = 6; + networking.hostName = hostName; + + imports = [ + ../../users/root.nix + ../../modules/nix_settings.nix + ]; + + environment.variables = { + __ETC_ZSHRC_SOURCED = "1"; + __ETC_ZSHENV_SOURCED = "1"; + }; + + # programs + programs = { + zsh.enable = true; + gnupg.agent = { + enable = true; + enableSSHSupport = true; + }; + }; + + # users + users = { + users = { + mika = { + shell = pkgs.zsh; + home = "/Users/mika"; + }; + root = { + shell = pkgs.zsh; + home = "/var/root"; + }; + }; + }; + + system = { + primaryUser = "mika"; + defaults = { + controlcenter = { + BatteryShowPercentage = true; + NowPlaying = false; + }; + CustomUserPreferences = { + "com.apple.symbolichotkeys" = { + "64" = { + # Disable 'Cmd + Space' for Spotlight Search + enabled = false; + }; + "65" = { + # Disable 'Cmd + Alt + Space' for Finder search window + enabled = false; + }; + "238" = { + # Set 'Control + Command + C' to center focused window + enabled = true; + value = { + parameters = [ + 99 + 8 + 1310720 + ]; + type = "standard"; + }; + }; + "98" = { + # Disable 'Show Help menu' + enabled = false; + value = { + parameters = [ + 47 + 44 + 1179648 + ]; + type = "standard"; + }; + }; + }; + }; + NSGlobalDomain = { + "com.apple.sound.beep.volume" = 0.000; + AppleInterfaceStyleSwitchesAutomatically = true; + ApplePressAndHoldEnabled = false; + AppleShowAllExtensions = true; + AppleMetricUnits = 1; + InitialKeyRepeat = 20; + KeyRepeat = 2; + NSAutomaticCapitalizationEnabled = false; + NSAutomaticDashSubstitutionEnabled = false; + NSAutomaticQuoteSubstitutionEnabled = false; + NSAutomaticSpellingCorrectionEnabled = false; + NSAutomaticWindowAnimationsEnabled = false; + NSDocumentSaveNewDocumentsToCloud = false; + NSNavPanelExpandedStateForSaveMode = true; + PMPrintingExpandedStateForPrint = true; + }; + trackpad = { + TrackpadRightClick = true; + TrackpadThreeFingerDrag = true; + Clicking = true; + }; + finder = { + AppleShowAllFiles = true; + CreateDesktop = false; + FXDefaultSearchScope = "SCcf"; + FXEnableExtensionChangeWarning = false; + FXPreferredViewStyle = "Nlsv"; + QuitMenuItem = true; + ShowPathbar = true; + ShowStatusBar = true; + _FXShowPosixPathInTitle = true; + _FXSortFoldersFirst = true; + }; + dock = { + autohide = true; + expose-animation-duration = 0.15; + show-recents = false; + showhidden = true; + persistent-apps = [ ]; + tilesize = 50; + wvous-bl-corner = 1; + wvous-br-corner = 1; + wvous-tl-corner = 1; + wvous-tr-corner = 1; + }; + }; + keyboard = { + enableKeyMapping = true; + swapLeftCtrlAndFn = true; + nonUS.remapTilde = true; + userKeyMapping = [ + { + HIDKeyboardModifierMappingSrc = 30064771172; + HIDKeyboardModifierMappingDst = 30064771125; + } + ]; + }; + }; + + nixpkgs.config.allowUnfree = true; + environment.systemPackages = with pkgs; [ + neovim + wget + git + nix + curl + tree + coreutils + stdenv + pciutils + util-linux + pstree + wireguard-tools + darwin.xcode_26 + ]; + + services.aerospace = { + enable = true; + settings = { + after-startup-command = [ ]; + enable-normalization-flatten-containers = true; + enable-normalization-opposite-orientation-for-nested-containers = true; + accordion-padding = 30; + default-root-container-layout = "tiles"; + default-root-container-orientation = "auto"; + on-focused-monitor-changed = [ "move-mouse monitor-lazy-center" ]; + automatically-unhide-macos-hidden-apps = false; + on-mode-changed = [ ]; + + key-mapping = { + preset = "qwerty"; + }; + + gaps = { + inner = { + horizontal = 10; + vertical = 10; + }; + outer = { + left = 10; + bottom = 10; + top = 10; + right = 10; + }; + }; + + mode.main.binding = { + alt-slash = "layout tiles horizontal vertical"; + alt-comma = "layout accordion horizontal vertical"; + + # Focus + alt-h = "focus left"; + alt-j = "focus down"; + alt-k = "focus up"; + alt-l = "focus right"; + + # Move + alt-shift-h = "move left"; + alt-shift-j = "move down"; + alt-shift-k = "move up"; + alt-shift-l = "move right"; + + # Resize + alt-minus = "resize smart -50"; + alt-equal = "resize smart +50"; + + # Workspace + alt-1 = "workspace 1"; + alt-2 = "workspace 2"; + alt-3 = "workspace 3"; + alt-4 = "workspace 4"; + alt-5 = "workspace 5"; + alt-6 = "workspace 6"; + alt-7 = "workspace 7"; + alt-8 = "workspace 8"; + alt-9 = "workspace 9"; + + # Move node to workspace + alt-shift-1 = "move-node-to-workspace 1"; + alt-shift-2 = "move-node-to-workspace 2"; + alt-shift-3 = "move-node-to-workspace 3"; + alt-shift-4 = "move-node-to-workspace 4"; + alt-shift-5 = "move-node-to-workspace 5"; + alt-shift-6 = "move-node-to-workspace 6"; + alt-shift-7 = "move-node-to-workspace 7"; + alt-shift-8 = "move-node-to-workspace 8"; + alt-shift-9 = "move-node-to-workspace 9"; + + alt-enter = "exec-and-forget open -n /Users/mika/Applications/kitty.app"; + alt-c = "exec-and-forget open -n /Users/mika/Applications/Firefox.app"; + alt-shift-w = "exec-and-forget open -n /Users/mika/Applications/Spotify.app"; + alt-shift-q = "close --quit-if-last-window"; + alt-m = "exec-and-forget /Users/mika/Applications/kitty.app/Contents/MacOS/kitty neomutt"; + alt-f = "fullscreen"; + + # Workspace navigation + alt-tab = "workspace-back-and-forth"; + alt-shift-tab = "move-workspace-to-monitor --wrap-around next"; + + # Mode + alt-shift-semicolon = "mode service"; + }; + + mode.service.binding = { + esc = [ + "reload-config" + "mode main" + ]; + r = [ + "flatten-workspace-tree" + "mode main" + ]; + f = [ + "layout floating tiling" + "mode main" + ]; + backspace = [ + "close-all-windows-but-current" + "mode main" + ]; + alt-shift-h = [ + "join-with left" + "mode main" + ]; + alt-shift-j = [ + "join-with down" + "mode main" + ]; + alt-shift-k = [ + "join-with up" + "mode main" + ]; + alt-shift-l = [ + "join-with right" + "mode main" + ]; + }; + }; + }; + + homebrew = { + enable = true; + user = "mika"; + prefix = "/opt/homebrew"; + brews = [ + "cocoapods" + "fastlane" + "watchman" + ]; + casks = [ ]; + onActivation = { + autoUpdate = true; + upgrade = true; + cleanup = "zap"; + }; + }; + + fonts.packages = with pkgs; [ + nerd-fonts.terminess-ttf + terminus_font + ]; +} diff --git a/machines/server/configuration.nix b/machines/server/configuration.nix @@ -0,0 +1,128 @@ +{ + pkgs, + hostName, + ... +}: +{ + imports = [ + ../../users/root.nix + ../../modules/nix_settings.nix + ]; + + system.stateVersion = "25.11"; + + # vm + virtualisation.vmVariant = { + virtualisation = { + diskSize = 50 * 1028; # 50 GB + memorySize = 16 * 1028; # 16 GB + cores = 6; + resolution = { + x = 1600; + y = 900; + }; + qemu.options = [ + "-enable-kvm" + "-cpu host" + "-display gtk,zoom-to-fit=false" + "-vga virtio" + ]; + forwardPorts = [ + { + from = "host"; + host.port = 2222; + guest.port = 61745; + } + ]; + }; + }; + + # boot + boot = { + loader = { + systemd-boot.enable = true; + efi.canTouchEfiVariables = true; + }; + kernelPackages = pkgs.linuxPackages_latest; + kernelParams = [ + "loglevel=3" + "nowatchdog" + "migrations=auto" + ]; + }; + + # netowrk + networking = { + hostName = "${hostName}"; + networkmanager.enable = true; + }; + + # time/locale + i18n.defaultLocale = "en_US.UTF-8"; + + # users + users.users = { + r2d2 = { + isNormalUser = true; + extraGroups = [ "wheel" ]; + initialPassword = "123"; + shell = pkgs.zsh; + openssh.authorizedKeys.keys = [ + "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCjUjMsWMlPY0YNtSPMdmCIBnNHzT8PdN7Gc0a+RuQg2slRe7Gh1HgRPAX0pg3CIh0oNTDfuOGrOTcl/SdX+WdhChZJkcoKiDKPB98TCioJnYF9k1vouhx0P3soN/Bd4gQEd2Vx0+XTQzmK9VhFtBoNQt9Eh90ZGCrBtsfPB9odDuymotI9FPXSboUPAe3WttzzUeTpY3JurInHW2rCQsYIvti0ZGwdm6EwVjN+6aZ300uT6olrAc+6csyOZrdQQXm1G35x6MLKpYoyFoGQYkS/4vvHMbzj9F9zp8Y+aUZ0+iQvK2owhS7auzELuO2/nqwODCHXLxn8Sg15r0XJn4tVvgAxqvtG+i0SIeqjfrzsu+fg1n2tJGCAq96nyOCruYHcmLOQ0Z9d+hf04Y1thS4GCtNmqT/RGdboDI1xEmg3PaUUPgaL7pCiG+6OtTC/4F0/f/m6neRn219UAPshI7LZKT1aRsBCqKRnEmbUSKWa0ilDntCDsST2VcHwKk0Tjnb+UIvjoHJ2qQQao7i1dmzZ8oUu/9wpyt5aaNxxvcm6qfjht1TGw/1RBHyhOsPNrlHpzUtzbvDdVwHfO0/6eksb73kJ7WMqU+FutbF5ekogcUzkYMo6G7O6hDMFb+w405ontM5syg6OcYWTq2+kllbKiGETxQpizzuWKERCExpHWQ== mika@frame" + ]; + }; + root = { + shell = pkgs.zsh; + }; + }; + security.sudo.wheelNeedsPassword = false; + + # services + services = { + fwupd.enable = true; + automatic-timezoned.enable = true; + openssh = { + enable = true; + ports = [ 61745 ]; + settings = { + PermitRootLogin = "no"; + PasswordAuthentication = false; + }; + }; + }; + + # programs + programs = { + zsh.enable = false; + dconf.enable = true; + gnupg.agent = { + enable = true; + enableSSHSupport = true; + }; + }; + + environment.variables = { + __ETC_ZSHRC_SOURCED = "1"; + __ETC_ZSHENV_SOURCED = "1"; + }; + + # packages + nixpkgs.config.allowUnfree = true; + environment.systemPackages = with pkgs; [ + neovim + wget + zsh + git + curl + tree + coreutils + stdenv + util-linux + pstree + ]; + + # fonts + fonts.packages = with pkgs; [ + terminus_font + ]; +} diff --git a/machines/server/disk.nix b/machines/server/disk.nix @@ -0,0 +1,40 @@ +{ + disko.devices = { + disk = { + my-disk = { + device = "/dev/vda"; + type = "disk"; + content = { + type = "gpt"; + partitions = { + ESP = { + type = "EF00"; + size = "512M"; + content = { + mountpoint = "/boot"; + type = "filesystem"; + format = "vfat"; + mountOptions = [ "umask=0077" ]; + }; + }; + swap = { + size = "8G"; + content = { + type ="swap"; + resumeDevice = true; + }; + }; + root = { + size = "100%"; + content = { + mountpoint = "/"; + type = "filesystem"; + format = "ext4"; + }; + }; + }; + }; + }; + }; + }; +} diff --git a/machines/server/hardware.nix b/machines/server/hardware.nix @@ -0,0 +1,16 @@ +# 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, modulesPath, ... }: + +{ + imports = + [ (modulesPath + "/profiles/qemu-guest.nix") ]; + + boot.initrd.availableKernelModules = [ "ahci" "xhci_pci" "virtio_pci" "virtio_scsi" "sr_mod" "virtio_blk" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-amd" ]; + boot.extraModulePackages = [ ]; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; +} diff --git a/machines/vm/disk.nix b/machines/vm/disk.nix @@ -0,0 +1,40 @@ +{ + disko.devices = { + disk = { + my-disk = { + device = "/dev/vda"; + type = "disk"; + content = { + type = "gpt"; + partitions = { + ESP = { + type = "EF00"; + size = "512M"; + content = { + mountpoint = "/boot"; + type = "filesystem"; + format = "vfat"; + mountOptions = [ "umask=0077" ]; + }; + }; + swap = { + size = "8G"; + content = { + type ="swap"; + resumeDevice = true; + }; + }; + root = { + size = "100%"; + content = { + mountpoint = "/"; + type = "filesystem"; + format = "ext4"; + }; + }; + }; + }; + }; + }; + }; +} diff --git a/machines/vm/hardware.nix b/machines/vm/hardware.nix @@ -0,0 +1,16 @@ +# 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, modulesPath, ... }: + +{ + imports = + [ (modulesPath + "/profiles/qemu-guest.nix") ]; + + boot.initrd.availableKernelModules = [ "ahci" "xhci_pci" "virtio_pci" "virtio_scsi" "sr_mod" "virtio_blk" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-amd" ]; + boot.extraModulePackages = [ ]; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; +} diff --git a/modules/packages.nix b/modules/packages.nix @@ -56,6 +56,14 @@ with pkgs; neovim ]; + wayland = [ + alacritty + swaybg + swaylock + xwayland-satellite + fuzzel + ]; + cli = [ (pass.withExtensions (exts: [ exts.pass-otp ])) ripgrep diff --git a/users/mika.nix b/users/mika.nix @@ -40,6 +40,7 @@ in fonts email development + wayland ] ++ lib.optionals (!isDarwin) [ xorg ] ); @@ -77,6 +78,20 @@ in }; }; + programs.niri = { + enable = true; + settings = { + binds = { + "Mod+Return".action.spawn = "alacritty"; + }; + prefer-no-csd = true; + layout = { + focus-ring.enable = true; + border.enable = false; + }; + }; + }; + imports = [ ../modules/mbsync_timer.nix ../modules/firefox.nix