diff options
| author | Brad Clawsie <brad@b7j0c.org> | 2026-12-05 12:27:31 -0600 |
|---|---|---|
| committer | Brad Clawsie <brad@b7j0c.org> | 2026-12-05 12:27:31 -0600 |
| commit | 6684177e36e5d9dff0a436e9878a265428505196 (patch) | |
| tree | e8d36f5cf2f6f4e3ca86506dbe2888fa9472cd19 | |
| parent | 2083c90eb7a1e086e2db76ad5f3ceaa4d167b8a2 (diff) | |
| -rw-r--r-- | nix/lenovo-base/base.nix | 23 | ||||
| -rw-r--r-- | nix/lenovo-base/configuration.nix | 20 | ||||
| -rw-r--r-- | nix/lenovo-base/desktop.nix | 90 | ||||
| -rw-r--r-- | nix/lenovo-base/hardware-configuration.nix | 33 | ||||
| -rw-r--r-- | nix/lenovo-base/local.example.nix | 4 | ||||
| -rw-r--r-- | nix/lenovo-base/local.nix | 4 | ||||
| -rw-r--r-- | nix/lenovo-base/nextdns.nix | 18 | ||||
| -rw-r--r-- | nix/lenovo-base/packages.nix | 23 | ||||
| -rw-r--r-- | nix/lenovo-base/users.nix | 19 | ||||
| -rw-r--r-- | nix/lenovo-base/virtualisation.nix | 18 |
10 files changed, 252 insertions, 0 deletions
diff --git a/nix/lenovo-base/base.nix b/nix/lenovo-base/base.nix new file mode 100644 index 0000000..1eb6a48 --- /dev/null +++ b/nix/lenovo-base/base.nix @@ -0,0 +1,23 @@ + +{ pkgs, ... }: + +{ + # Boot + boot.loader = { + systemd-boot.enable = true; + efi.canTouchEfiVariables = true; + }; + + boot.kernelPackages = pkgs.linuxPackages_latest; + + # Networking + networking.networkmanager.enable = true; + networking.firewall.enable = true; + + # Locale + time.timeZone = "America/Chicago"; + i18n.defaultLocale = "en_US.UTF-8"; + + # Package policy + nixpkgs.config.allowUnfree = true; +} diff --git a/nix/lenovo-base/configuration.nix b/nix/lenovo-base/configuration.nix new file mode 100644 index 0000000..90108e3 --- /dev/null +++ b/nix/lenovo-base/configuration.nix @@ -0,0 +1,20 @@ + +{ ... }: + +{ + imports = [ + ./hardware-configuration.nix + ./base.nix + ./desktop.nix + ./users.nix + ./packages.nix + ./virtualisation.nix + ./nextdns.nix + ]; + + networking.hostName = "nixos"; + + # Preserve the version from the original installation. + # Do not change this when upgrading NixOS. + system.stateVersion = "26.11"; +} diff --git a/nix/lenovo-base/desktop.nix b/nix/lenovo-base/desktop.nix new file mode 100644 index 0000000..416101c --- /dev/null +++ b/nix/lenovo-base/desktop.nix @@ -0,0 +1,90 @@ + +{ ... }: + +{ + # Desktop environment + services.displayManager.gdm.enable = true; + services.desktopManager.gnome.enable = true; + + # Keyboard + services.xserver.xkb = { + layout = "us"; + options = "ctrl:nocaps"; + }; + + # Printing + services.printing.enable = true; + + # Audio + services.pulseaudio.enable = false; + security.rtkit.enable = true; + + services.pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + }; + + # Browser + programs.firefox = { + enable = true; + policies = { + DNSOverHTTPS = { + Enabled = false; + Locked = true; + }; + }; + }; + + # GNOME preferences + programs.dconf = { + enable = true; + profiles.user.databases = [ + { + settings = { + "org/gnome/desktop/input-sources" = { + xkb-options = [ "ctrl:nocaps" ]; + }; + + "org/gnome/Console" = { + use-system-font = false; + custom-font = "Adwaita Mono 24"; + theme = "night"; + audible-bell = false; + visual-bell = false; + ignore-scrollback-limit = true; + restore-window-size = true; + last-window-maximised = true; + transparency = false; + software-flow-control = false; + }; + + "org/gnome/desktop/interface" = { + cursor-blink = false; + }; + + # Global keyboard shortcuts + "org/gnome/settings-daemon/plugins/media-keys" = { + custom-keybindings = [ + "/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/terminal/" + "/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/firefox/" + ]; + }; + + "org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/terminal" = { + name = "Launch Terminal"; + command = "kgx"; + binding = "<Alt>u"; + }; + + "org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/firefox" = { + name = "Launch Firefox"; + command = "firefox"; + binding = "<Alt>c"; + }; + }; + } + ]; + }; +} diff --git a/nix/lenovo-base/hardware-configuration.nix b/nix/lenovo-base/hardware-configuration.nix new file mode 100644 index 0000000..a3d96a8 --- /dev/null +++ b/nix/lenovo-base/hardware-configuration.nix @@ -0,0 +1,33 @@ +# 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 + "/installer/scan/not-detected.nix") + ]; + + boot.initrd.availableKernelModules = [ "xhci_pci" "nvme" "usb_storage" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/mapper/luks-f1b9890c-eaf0-4032-a57d-206757187dc4"; + fsType = "ext4"; + }; + + boot.initrd.luks.devices."luks-f1b9890c-eaf0-4032-a57d-206757187dc4".device = "/dev/disk/by-uuid/f1b9890c-eaf0-4032-a57d-206757187dc4"; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/9901-D4A1"; + fsType = "vfat"; + options = [ "fmask=0077" "dmask=0077" ]; + }; + + swapDevices = [ ]; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/nix/lenovo-base/local.example.nix b/nix/lenovo-base/local.example.nix new file mode 100644 index 0000000..898d434 --- /dev/null +++ b/nix/lenovo-base/local.example.nix @@ -0,0 +1,4 @@ + +{ + nextdnsProfile = "YOUR_CONFIG_ID"; +} diff --git a/nix/lenovo-base/local.nix b/nix/lenovo-base/local.nix new file mode 100644 index 0000000..898d434 --- /dev/null +++ b/nix/lenovo-base/local.nix @@ -0,0 +1,4 @@ + +{ + nextdnsProfile = "YOUR_CONFIG_ID"; +} diff --git a/nix/lenovo-base/nextdns.nix b/nix/lenovo-base/nextdns.nix new file mode 100644 index 0000000..071c708 --- /dev/null +++ b/nix/lenovo-base/nextdns.nix @@ -0,0 +1,18 @@ + +{ ... }: + +let + local = import ./local.nix; +in +{ + services.nextdns = { + enable = true; + + arguments = [ + "-config" local.nextdnsProfile + "-cache-size" "10MB" + "-report-client-info" + "-auto-activate" + ]; + }; +} diff --git a/nix/lenovo-base/packages.nix b/nix/lenovo-base/packages.nix new file mode 100644 index 0000000..3654ac6 --- /dev/null +++ b/nix/lenovo-base/packages.nix @@ -0,0 +1,23 @@ + +{ pkgs, ... }: + +{ + programs.git.enable = true; + programs.tmux.enable = true; + + programs.gnupg.agent = { + enable = true; + enableSSHSupport = false; + pinentryPackage = pkgs.pinentry-curses; + }; + + environment.variables.EDITOR = "emacs"; + + environment.systemPackages = with pkgs; [ + delta + emacs-nox + keychain + pass + wget + ]; +} diff --git a/nix/lenovo-base/users.nix b/nix/lenovo-base/users.nix new file mode 100644 index 0000000..41be7b4 --- /dev/null +++ b/nix/lenovo-base/users.nix @@ -0,0 +1,19 @@ + +{ pkgs, ... }: + +{ + programs.fish.enable = true; + + users.users.brad = { + isNormalUser = true; + description = "Brad Clawsie"; + shell = pkgs.fish; + + extraGroups = [ + "networkmanager" + "wheel" + "libvirtd" + "kvm" + ]; + }; +} diff --git a/nix/lenovo-base/virtualisation.nix b/nix/lenovo-base/virtualisation.nix new file mode 100644 index 0000000..80b121b --- /dev/null +++ b/nix/lenovo-base/virtualisation.nix @@ -0,0 +1,18 @@ + +{ pkgs, ... }: + +{ + virtualisation.libvirtd = { + enable = true; + qemu.runAsRoot = false; + }; + + programs.virt-manager.enable = false; + + environment.variables.LIBVIRT_DEFAULT_URI = "qemu:///system"; + + environment.systemPackages = with pkgs; [ + libvirt + virt-manager + ]; +} |
