From 8dcf355819cc6cd1e87924218c1adcd900ecda84 Mon Sep 17 00:00:00 2001 From: Alexander Kassouni Date: Fri, 28 Aug 2026 23:27:52 -0700 Subject: refactor base nixos modules --- machines/common/base.nix | 19 ++++ machines/common/default.nix | 12 +++ machines/common/pipewire.nix | 18 ++++ machines/common/printer.nix | 17 +++ machines/common/rip.nix | 3 + machines/common/tailscale.nix | 8 ++ machines/common/user.nix | 13 +++ machines/common/x11.nix | 14 +++ machines/hierophant/configuration.nix | 150 +-------------------------- machines/magician/configuration.nix | 49 +++++++++ machines/magician/hardware-configuration.nix | 32 ++++++ 11 files changed, 187 insertions(+), 148 deletions(-) create mode 100644 machines/common/base.nix create mode 100644 machines/common/default.nix create mode 100644 machines/common/pipewire.nix create mode 100644 machines/common/printer.nix create mode 100644 machines/common/rip.nix create mode 100644 machines/common/tailscale.nix create mode 100644 machines/common/user.nix create mode 100644 machines/common/x11.nix create mode 100644 machines/magician/configuration.nix create mode 100644 machines/magician/hardware-configuration.nix (limited to 'machines') diff --git a/machines/common/base.nix b/machines/common/base.nix new file mode 100644 index 0000000..46c82d9 --- /dev/null +++ b/machines/common/base.nix @@ -0,0 +1,19 @@ +{...}: { + virtualisation.docker = { + enable = true; + }; + + nix.settings.experimental-features = [ + "nix-command" + "flakes" + ]; + + nixpkgs.config.allowUnfree = true; + + programs.steam.enable = true; + + time.timeZone = "America/Los_Angeles"; + i18n.defaultLocale = "en_US.UTF-8"; + + networking.networkmanager.enable = true; +} diff --git a/machines/common/default.nix b/machines/common/default.nix new file mode 100644 index 0000000..df8e60c --- /dev/null +++ b/machines/common/default.nix @@ -0,0 +1,12 @@ +{ ... }: +{ + imports = [ + ./base.nix + ./pipewire.nix + ./printer.nix + ./rip.nix + ./tailscale.nix + ./user.nix + ./x11.nix + ]; +} diff --git a/machines/common/pipewire.nix b/machines/common/pipewire.nix new file mode 100644 index 0000000..662d7fe --- /dev/null +++ b/machines/common/pipewire.nix @@ -0,0 +1,18 @@ +{...}: { + security.rtkit.enable = true; + + services.pipewire = { + enable = true; + pulse.enable = true; + alsa.enable = true; + extraConfig.pipewire."10-clock-rates" = { + "context.properties" = { + "default.clock.rate" = 48000; + "default.clock.allowed-rates" = [ + 44100 + 48000 + ]; + }; + }; + }; +} diff --git a/machines/common/printer.nix b/machines/common/printer.nix new file mode 100644 index 0000000..695d1fe --- /dev/null +++ b/machines/common/printer.nix @@ -0,0 +1,17 @@ +{pkgs, ...}: { + services.avahi = { + enable = true; + nssmdns4 = true; + openFirewall = true; + }; + + services.printing = { + enable = true; + drivers = with pkgs; [ + cups-filters + cups-browsed + ]; + }; + + services.ipp-usb.enable = true; +} diff --git a/machines/common/rip.nix b/machines/common/rip.nix new file mode 100644 index 0000000..c02ad7f --- /dev/null +++ b/machines/common/rip.nix @@ -0,0 +1,3 @@ +{ ... }: { + boot.kernelModules = [ "sg" ]; +} diff --git a/machines/common/tailscale.nix b/machines/common/tailscale.nix new file mode 100644 index 0000000..4e99eaa --- /dev/null +++ b/machines/common/tailscale.nix @@ -0,0 +1,8 @@ +{pkgs-unstable, ...}: { + services.tailscale = { + package = pkgs-unstable.tailscale; + enable = true; + extraSetFlags = [ "--ssh" ]; + extraDaemonFlags = [ "--no-logs-no-support" ]; + }; +} diff --git a/machines/common/user.nix b/machines/common/user.nix new file mode 100644 index 0000000..adac815 --- /dev/null +++ b/machines/common/user.nix @@ -0,0 +1,13 @@ +{...}: { + users.users.kassouni = { + isNormalUser = true; + home = "/home/kassouni"; + extraGroups = [ + "wheel" + "video" + "docker" + "input" + "audio" + ]; + }; +} diff --git a/machines/common/x11.nix b/machines/common/x11.nix new file mode 100644 index 0000000..ed2084a --- /dev/null +++ b/machines/common/x11.nix @@ -0,0 +1,14 @@ +{...}: { + services.displayManager.ly = { + enable = true; + x11Support = true; + }; + + services.xserver = { + enable = true; + xkb = { + layout = "us"; + options = "caps:escape"; + }; + }; +} diff --git a/machines/hierophant/configuration.nix b/machines/hierophant/configuration.nix index a9a8d2c..01a2d25 100644 --- a/machines/hierophant/configuration.nix +++ b/machines/hierophant/configuration.nix @@ -1,12 +1,5 @@ -# Edit this configuration file to define what should be installed on -# your system. Help is available in the configuration.nix(5) man page, on -# https://search.nixos.org/options and in the NixOS manual (`nixos-help`). - { - config, - lib, pkgs, - pkgs-unstable, ... }: @@ -16,158 +9,19 @@ ./hardware-configuration.nix ]; - security.polkit.enable = true; - boot.loader.systemd-boot.enable = true; boot.loader.efi.canTouchEfiVariables = true; - boot.kernelModules = [ "sg" ]; - - virtualisation.docker = { - enable = true; - }; - - nix.settings.experimental-features = [ - "nix-command" - "flakes" - ]; - - services.avahi = { - enable = true; - nssmdns4 = true; - openFirewall = true; - }; - - services.printing = { - enable = true; - drivers = with pkgs; [ - cups-filters - cups-browsed - ]; - }; - - services.ipp-usb.enable = true; - - services.gnome.gnome-keyring.enable = true; - - services.tailscale = { - package = pkgs-unstable.tailscale; - enable = true; - extraSetFlags = [ "--ssh" ]; - extraDaemonFlags = [ "--no-logs-no-support" ]; - }; - - nixpkgs.config.allowUnfree = true; hardware.graphics.enable = true; - services.xserver.enable = true; services.xserver.videoDrivers = [ "nvidia" ]; hardware.nvidia.open = true; - programs.steam.enable = true; - - services.displayManager.ly.enable = true; - services.displayManager.ly.x11Support = true; - services.xserver.displayManager.sessionCommands = '' xrandr --output DP-0 --mode 3840x2160 --rate 159.98 ''; - networking.hostName = "hierophant"; # Define your hostname. - # Pick only one of the below networking options. - # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. - # networking.networkmanager.enable = true; # Easiest to use and most distros use this by default. - - # Set your time zone. - time.timeZone = "America/Los_Angeles"; - - # Configure network proxy if necessary - # networking.proxy.default = "http://user:password@proxy:port/"; - # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain"; - - # Select internationalisation properties. - i18n.defaultLocale = "en_US.UTF-8"; - # console = { - # font = "Lat2-Terminus16"; - # keyMap = "us"; - # useXkbConfig = true; # use xkb.options in tty. - # }; - - # Configure keymap in X11 - # services.xserver.xkb.layout = "us"; - # services.xserver.xkb.options = "eurosign:e,caps:escape"; - - # Enable CUPS to print documents. - # services.printing.enable = true; - - # Enable sound. - # services.pulseaudio.enable = true; - # OR - - security.rtkit.enable = true; - - services.pipewire = { - enable = true; - pulse.enable = true; - alsa.enable = true; - extraConfig.pipewire."10-clock-rates" = { - "context.properties" = { - "default.clock.rate" = 48000; - "default.clock.allowed-rates" = [ - 44100 - 48000 - ]; - }; - }; - }; - - # Enable touchpad support (enabled default in most desktopManager). - # services.libinput.enable = true; - - # Define a user account. Don't forget to set a password with ‘passwd’. - users.users.kassouni = { - isNormalUser = true; - home = "/home/kassouni"; - extraGroups = [ - "wheel" - "video" - "docker" - "input" - "audio" - ]; # Enable 'sudo' for the user. - }; - - fonts.packages = with pkgs; [ - dejavu_fonts - ]; - - - # List packages installed in system profile. - # You can use https://search.nixos.org/ to find more packages (and options). - environment.systemPackages = with pkgs; [ ]; - - # 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: - - # Enable the OpenSSH daemon. - - # Open ports in the firewall. - # networking.firewall.allowedTCPPorts = [ ... ]; - # networking.firewall.allowedUDPPorts = [ ... ]; - # Or disable the firewall altogether. - # networking.firewall.enable = false; - - # Copy the NixOS configuration file and link it from the resulting system - # (/run/current-system/configuration.nix). This is useful in case you - # accidentally delete configuration.nix. - # system.copySystemConfiguration = true; - + networking.hostName = "hierophant"; + # This option defines the first version of NixOS you have installed on this particular machine, # and is used to maintain compatibility with application data (e.g. databases) created on older NixOS versions. # diff --git a/machines/magician/configuration.nix b/machines/magician/configuration.nix new file mode 100644 index 0000000..01734eb --- /dev/null +++ b/machines/magician/configuration.nix @@ -0,0 +1,49 @@ +{...}: +{ + imports = [ + # Include the results of the hardware scan. + ./hardware-configuration.nix + ]; + + services.upower.enable = true; + + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + hardware.graphics.enable = true; + services.xserver.videoDrivers = [ "modesetting" ]; + + environment.variables = { + "MOZ_USE_XINPUT2" = "1"; + }; + + services.xserver.displayManager.sessionCommands = '' + xrandr --output eDP-1 --mode 2880x1920 --rate 120.00 + ''; + + services.xserver.dpi = 192; + + networking.hostName = "magician"; + + services.libinput.enable = true; + + # This option defines the first version of NixOS you have installed on this particular machine, + # and is used to maintain compatibility with application data (e.g. databases) created on older NixOS versions. + # + # Most users should NEVER change this value after the initial install, for any reason, + # even if you've upgraded your system to a new NixOS release. + # + # This value does NOT affect the Nixpkgs version your packages and OS are pulled from, + # so changing it will NOT upgrade your system - see https://nixos.org/manual/nixos/stable/#sec-upgrading for how + # to actually do that. + # + # This value being lower than the current NixOS release does NOT mean your system is + # out of date, out of support, or vulnerable. + # + # Do NOT change this value unless you have manually inspected all the changes it would make to your configuration, + # and migrated your data accordingly. + # + # For more information, see `man configuration.nix` or https://nixos.org/manual/nixos/stable/options#opt-system.stateVersion . + system.stateVersion = "26.05"; # Did you read the comment? + +} diff --git a/machines/magician/hardware-configuration.nix b/machines/magician/hardware-configuration.nix new file mode 100644 index 0000000..970852d --- /dev/null +++ b/machines/magician/hardware-configuration.nix @@ -0,0 +1,32 @@ +# 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" "thunderbolt" "nvme" "usb_storage" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/6ec028fe-0eda-4877-83d3-dabb244f6078"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/8980-2C75"; + fsType = "vfat"; + options = [ "fmask=0077" "dmask=0077" ]; + }; + + swapDevices = [ ]; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.intel.npu.enable = true; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} -- cgit v1.3.1