From fc2ca20f6d87ebcc7674df8b8de30a5584317a05 Mon Sep 17 00:00:00 2001 From: quinm0 Date: Fri, 13 Mar 2026 23:21:46 -0400 Subject: [PATCH] NixOS module fun - Group module settings into config files - no more root configuration outside of flake - added readme for future me --- configuration.nix | 78 -------------------------------------- flake.nix | 6 ++- hardware-configuration.nix | 35 ----------------- nix/README.md | 13 +++++++ nix/common.nix | 37 ++++++++++++++++++ nix/gui1.nix | 15 ++++++++ nix/qlhc.nix | 43 +++++++++++++++++++++ nix/user-quin.nix | 25 ++++++++++++ 8 files changed, 137 insertions(+), 115 deletions(-) delete mode 100644 configuration.nix delete mode 100644 hardware-configuration.nix create mode 100644 nix/README.md create mode 100644 nix/common.nix create mode 100644 nix/gui1.nix create mode 100644 nix/qlhc.nix create mode 100644 nix/user-quin.nix diff --git a/configuration.nix b/configuration.nix deleted file mode 100644 index 9084160..0000000 --- a/configuration.nix +++ /dev/null @@ -1,78 +0,0 @@ -{ config, pkgs, ... }: - -{ - # Base system things that all should know and love - system.stateVersion = "25.11"; - nixpkgs.config.allowUnfree = true; - nix.settings.experimental-features = [ "nix-command" "flakes" ]; - time.timeZone = "America/New_York"; - i18n.defaultLocale = "en_US.UTF-8"; - i18n.extraLocaleSettings = { - LC_ADDRESS = "en_US.UTF-8"; - LC_IDENTIFICATION = "en_US.UTF-8"; - LC_MEASUREMENT = "en_US.UTF-8"; - LC_MONETARY = "en_US.UTF-8"; - LC_NAME = "en_US.UTF-8"; - LC_NUMERIC = "en_US.UTF-8"; - LC_PAPER = "en_US.UTF-8"; - LC_TELEPHONE = "en_US.UTF-8"; - LC_TIME = "en_US.UTF-8"; - }; - - environment.systemPackages = with pkgs; [ - git - tailscale - ]; - - networking.networkmanager.enable = true; - networking.hostName = "qmoran-laptop"; - - # My user for now - users.users.qmoran = { - isNormalUser = true; - description = "quin"; - extraGroups = [ "networkmanager" "wheel" "docker" ]; - packages = with pkgs; [ - gh - btop - kdePackages.kate - signal-desktop - lazygit - element-desktop - vscodium - vivaldi - ]; - }; - - # Bootloader. - boot.loader.systemd-boot.enable = true; - boot.loader.efi.canTouchEfiVariables = true; - boot.initrd.luks.devices."luks-df4da4a4-149f-433d-a0c9-efcb7f3acc52".device = "/dev/disk/by-uuid/df4da4a4-149f-433d-a0c9-efcb7f3acc52"; - - # Services - virtualisation.docker.enable = true; # Docker - services.printing.enable = true; # CUPS - services.tailscale.enable = true; # Tailscale - - # GUI / UX - services.xserver.enable = true; - services.xserver.excludePackages = [ - pkgs.xterm - ]; - services.displayManager.sddm.enable = true; - services.desktopManager.plasma6.enable = true; - services.xserver.xkb = { - layout = "us"; - variant = ""; - }; - - # Enable sound with pipewire. - services.pulseaudio.enable = false; - security.rtkit.enable = true; - services.pipewire = { - enable = true; - alsa.enable = true; - alsa.support32Bit = true; - pulse.enable = true; - }; -} diff --git a/flake.nix b/flake.nix index 117afe9..4eaa74c 100644 --- a/flake.nix +++ b/flake.nix @@ -14,8 +14,10 @@ nixosConfigurations.qmoran-laptop = nixpkgs.lib.nixosSystem { system = "x86_64-linux"; modules = [ - ./hardware-configuration.nix - ./configuration.nix + ./nix/qlhc.nix + ./nix/common.nix + ./nix/user-quin.nix + ./nix/gui1.nix ]; }; }; diff --git a/hardware-configuration.nix b/hardware-configuration.nix deleted file mode 100644 index 7c210b3..0000000 --- a/hardware-configuration.nix +++ /dev/null @@ -1,35 +0,0 @@ -# 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" ]; - boot.initrd.kernelModules = [ ]; - boot.kernelModules = [ "kvm-intel" ]; - boot.extraModulePackages = [ ]; - - fileSystems."/" = - { device = "/dev/mapper/luks-ca82dbc3-42a8-4582-99b6-0b6d271dc897"; - fsType = "ext4"; - }; - - boot.initrd.luks.devices."luks-ca82dbc3-42a8-4582-99b6-0b6d271dc897".device = "/dev/disk/by-uuid/ca82dbc3-42a8-4582-99b6-0b6d271dc897"; - - fileSystems."/boot" = - { device = "/dev/disk/by-uuid/5C65-493B"; - fsType = "vfat"; - options = [ "fmask=0077" "dmask=0077" ]; - }; - - swapDevices = - [ { device = "/dev/mapper/luks-df4da4a4-149f-433d-a0c9-efcb7f3acc52"; } - ]; - - nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; - hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; -} diff --git a/nix/README.md b/nix/README.md new file mode 100644 index 0000000..83872e4 --- /dev/null +++ b/nix/README.md @@ -0,0 +1,13 @@ +# It's NixOS! + +Hello MtV and welcome to my crib. These are all the things pertaining to my nixos stuff. + +- [./common.nix](./common.nix) is all the common things that hosts will have configured + - Services + - locale settings + - timezone +- [./gui1](./gui1.nix) all config things for a linux UX experience, KDE Plasma in this instance, but perhaps there could be a gui2 someday... +- [./qlhc.nix](./qlhc.nix) this stands for quins-laptop-hardware-configuraion. I'll find a better way to do this stuff later. +- [./user-quin](./user-quin.nix) my personal user account, here for all to see. + - packages + - groups \ No newline at end of file diff --git a/nix/common.nix b/nix/common.nix new file mode 100644 index 0000000..2e766a5 --- /dev/null +++ b/nix/common.nix @@ -0,0 +1,37 @@ +{ config, pkgs, ... }: + +{ + # Base system things that all should know and love + system.stateVersion = "25.11"; + nixpkgs.config.allowUnfree = true; + time.timeZone = "America/New_York"; + i18n.defaultLocale = "en_US.UTF-8"; + networking.networkmanager.enable = true; + + #Services + virtualisation.docker.enable = true; # Docker + services.printing.enable = true; # CUPS + services.tailscale.enable = true; # Tailscale + + nix.settings.experimental-features = [ + "nix-command" + "flakes" + ]; + + i18n.extraLocaleSettings = { + LC_ADDRESS = "en_US.UTF-8"; + LC_IDENTIFICATION = "en_US.UTF-8"; + LC_MEASUREMENT = "en_US.UTF-8"; + LC_MONETARY = "en_US.UTF-8"; + LC_NAME = "en_US.UTF-8"; + LC_NUMERIC = "en_US.UTF-8"; + LC_PAPER = "en_US.UTF-8"; + LC_TELEPHONE = "en_US.UTF-8"; + LC_TIME = "en_US.UTF-8"; + }; + + environment.systemPackages = with pkgs; [ + git + tailscale + ]; +} \ No newline at end of file diff --git a/nix/gui1.nix b/nix/gui1.nix new file mode 100644 index 0000000..d118e10 --- /dev/null +++ b/nix/gui1.nix @@ -0,0 +1,15 @@ +{ config, pkgs, ... }: + +{ + # GUI / UX + services.xserver.enable = true; + services.xserver.excludePackages = [ + pkgs.xterm + ]; + services.displayManager.sddm.enable = true; + services.desktopManager.plasma6.enable = true; + services.xserver.xkb = { + layout = "us"; + variant = ""; + }; +} \ No newline at end of file diff --git a/nix/qlhc.nix b/nix/qlhc.nix new file mode 100644 index 0000000..184abd6 --- /dev/null +++ b/nix/qlhc.nix @@ -0,0 +1,43 @@ +# I modified it >:3 +{ config, lib, pkgs, modulesPath, ... }: + +{ + imports =[ + (modulesPath + "/installer/scan/not-detected.nix") + ]; + + networking.hostName = "qmoran-laptop"; + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + boot.kernelModules = [ "kvm-intel" ]; + boot.initrd.availableKernelModules = [ "xhci_pci" "thunderbolt" "nvme" ]; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; + boot.initrd.luks.devices."luks-ca82dbc3-42a8-4582-99b6-0b6d271dc897".device = "/dev/disk/by-uuid/ca82dbc3-42a8-4582-99b6-0b6d271dc897"; + # boot.initrd.kernelModules = [ ]; # Woah this might be helpful for those routers I have! + # boot.extraModulePackages = [ ]; + + # Bootloader. + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + boot.initrd.luks.devices."luks-df4da4a4-149f-433d-a0c9-efcb7f3acc52".device = "/dev/disk/by-uuid/df4da4a4-149f-433d-a0c9-efcb7f3acc52"; + + swapDevices = [ + { + device = "/dev/mapper/luks-df4da4a4-149f-433d-a0c9-efcb7f3acc52"; + } + ]; + + fileSystems."/" = { + device = "/dev/mapper/luks-ca82dbc3-42a8-4582-99b6-0b6d271dc897"; + fsType = "ext4"; + }; + + fileSystems."/boot" = { + device = "/dev/disk/by-uuid/5C65-493B"; + fsType = "vfat"; + options = [ + "fmask=0077" + "dmask=0077" + ]; + }; + +} diff --git a/nix/user-quin.nix b/nix/user-quin.nix new file mode 100644 index 0000000..d0641c2 --- /dev/null +++ b/nix/user-quin.nix @@ -0,0 +1,25 @@ +{ config, pkgs, ... }: + +{ + # My user for now + users.users.qmoran = { + isNormalUser = true; + description = "quin"; + extraGroups = [ + "wheel" + "docker" + "networkmanager" + ]; + packages = with pkgs; [ + gh + btop + ctop + kdePackages.kate + signal-desktop + lazygit + element-desktop + vscodium + vivaldi + ]; + }; +} \ No newline at end of file