diff options
| author | Kyren223 <Kyren223@proton.me> | 2025-05-16 16:06:11 +0300 |
|---|---|---|
| committer | Kyren223 <Kyren223@proton.me> | 2025-05-16 16:06:11 +0300 |
| commit | 2c5db1c0de31ac1b16f77d5b2b7412e1d4e4afc3 (patch) | |
| tree | 7c6bb44aa007a2a89fb96e699a294c035d080a25 | |
| parent | 4423b2f08f38c60b1e93c8a2182e6826768ceaa2 (diff) | |
Refactored NixOS config to be more modular
| -rw-r--r-- | hosts/configuration.nix (renamed from modules/common.nix) | 62 | ||||
| -rw-r--r-- | hosts/desktop.nix | 18 | ||||
| -rw-r--r-- | hosts/home.nix | 14 | ||||
| -rw-r--r-- | hosts/lapsktop.nix | 18 | ||||
| -rw-r--r-- | hosts/laptop.nix | 17 | ||||
| -rw-r--r-- | modules/apps.nix | 112 | ||||
| -rw-r--r-- | modules/development.nix | 66 | ||||
| -rw-r--r-- | modules/gaming.nix | 33 | ||||
| -rw-r--r-- | modules/packages.nix | 140 |
9 files changed, 260 insertions, 220 deletions
diff --git a/modules/common.nix b/hosts/configuration.nix index b9fed82..2e025d6 100644 --- a/modules/common.nix +++ b/hosts/configuration.nix @@ -1,10 +1,23 @@ -{ pkgs, ... }: { +{ pkgs, inputs, ... }: { imports = [ - ./packages.nix + ../modules/apps.nix + ../modules/kde.nix + ../modules/networking.nix + ../modules/development.nix + ../modules/gaming.nix + inputs.home-manager.nixosModules.default ]; - # User + home-manager = { + extraSpecialArgs = { inherit inputs pkgs; }; + useUserPackages = true; + useGlobalPkgs = true; + users = { + "kyren" = import ./home.nix; + }; + }; + users.users.kyren = { isNormalUser = true; description = "Kyren"; @@ -29,7 +42,7 @@ # Bootloader boot.loader.systemd-boot.enable = true; boot.loader.efi.canTouchEfiVariables = true; - boot.supportedFilesystems = [ "ntfs" ]; + boot.supportedFilesystems = [ "ntfs" ]; # for windows fs # Nix Config system.stateVersion = "24.05"; # DO NOT CHANGE! @@ -44,23 +57,6 @@ stdenv.cc.cc ]; - programs.firefox.enable = true; - - # Install Steam - programs.steam = { - enable = true; - remotePlay.openFirewall = true; # Open ports in the firewall for Steam Remote Play - dedicatedServer.openFirewall = true; # Open ports in the firewall for Source Dedicated Server - localNetworkGameTransfers.openFirewall = true; # Open ports in the firewall for Steam Local Network Game Transfers - }; - - # Install Docker (without using root access) - #virtualisation.docker.enable = true; - virtualisation.docker.rootless = { - enable = true; - setSocketVariable = true; - }; - # Enable sound with pipewire. services.pulseaudio.enable = false; security.rtkit.enable = true; @@ -85,9 +81,11 @@ # Enable openssh services.openssh.enable = true; + services.openssh.settings.PasswordAuthentication = false; - # Mouse config service (used with piper) - services.ratbagd.enable = true; + users.users.root.openssh.authorizedKeys.keys = [ + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIO7P9K9D5RkBk+JCRRS6AtHuTAc6cRpXfRfRMg/Kyren" + ]; # Enable KVM/QEMU virtualization programs.virt-manager.enable = true; @@ -105,10 +103,6 @@ systemd.tmpfiles.rules = [ "d /home/kyren/.config/syncthing 0700 kyren users" ]; - - # VPN for Vault Hunters to avoid connection issues - # Note, will break discord, also tried proton VPN, still has conn issues - services.cloudflare-warp.enable = true; systemd.timers."git-auto-sync" = { wantedBy = [ "timers.target" ]; @@ -143,4 +137,18 @@ script = "$HOME/projects/k/bin/k tracker sleep"; serviceConfig = { Type = "oneshot"; User = "kyren"; }; }; + + xdg.desktopEntries = { + "com.ktechpit.whatsie" = { + name = "WhatsApp"; + genericName = "Watsie, unofficial WhatsApp client"; + exec = "whatsie %U"; + terminal = false; + icon = "com.github.eneshecan.WhatsAppForLinux"; + categories = [ "Application" "Network" "WebBrowser" ]; + settings = { + Keywords = "chat;im;messaging;messenger;sms;whatsapp;whatsapp-desktop;whatsie;"; + }; + }; + }; } diff --git a/hosts/desktop.nix b/hosts/desktop.nix index 1698ad3..a4aae0d 100644 --- a/hosts/desktop.nix +++ b/hosts/desktop.nix @@ -1,22 +1,14 @@ -{ pkgs, inputs, ... }: { +{ ... }: { imports = [ ./hardware-configuration-desktop.nix - ../modules/common.nix - ../modules/kde.nix - ../modules/networking.nix + ./configuration.nix ../modules/desktop.nix - inputs.home-manager.nixosModules.default ]; networking.hostName = "kyren-desktop"; - home-manager = { - extraSpecialArgs = { inherit inputs pkgs; }; - useUserPackages = true; - useGlobalPkgs = true; - users = { - "kyren" = import ./home.nix; - }; - }; + development.enable = true; + gaming.enable = true; + } diff --git a/hosts/home.nix b/hosts/home.nix index a9ce356..ef8ecea 100644 --- a/hosts/home.nix +++ b/hosts/home.nix @@ -25,20 +25,6 @@ "$HOME/.local/bin" ]; - xdg.desktopEntries = { - "com.ktechpit.whatsie" = { - name = "WhatsApp"; - genericName = "Watsie, unofficial WhatsApp client"; - exec = "whatsie %U"; - terminal = false; - icon = "com.github.eneshecan.WhatsAppForLinux"; - categories = [ "Application" "Network" "WebBrowser" ]; - settings = { - Keywords = "chat;im;messaging;messenger;sms;whatsapp;whatsapp-desktop;whatsie;"; - }; - }; - }; - # Let Home Manager install and manage itself. programs.home-manager.enable = true; } diff --git a/hosts/lapsktop.nix b/hosts/lapsktop.nix index bf25017..80346e3 100644 --- a/hosts/lapsktop.nix +++ b/hosts/lapsktop.nix @@ -1,22 +1,14 @@ -{ pkgs, inputs, ... }: { +{ ... }: { imports = [ ./hardware-configuration-laptop.nix - ../modules/common.nix - ../modules/kde.nix - ../modules/networking.nix + ./hardware-configuration-laptop.nix + ./configuration.nix ../modules/laptop.nix - inputs.home-manager.nixosModules.default ]; networking.hostName = "kyren-laptop"; - home-manager = { - extraSpecialArgs = { inherit inputs pkgs; }; - useUserPackages = true; - useGlobalPkgs = true; - users = { - "kyren" = import ./home.nix; - }; - }; + development.enable = true; + } diff --git a/hosts/laptop.nix b/hosts/laptop.nix index bf25017..f4a2603 100644 --- a/hosts/laptop.nix +++ b/hosts/laptop.nix @@ -1,22 +1,13 @@ -{ pkgs, inputs, ... }: { +{ ... }: { imports = [ ./hardware-configuration-laptop.nix - ../modules/common.nix - ../modules/kde.nix - ../modules/networking.nix + ./configuration.nix ../modules/laptop.nix - inputs.home-manager.nixosModules.default ]; networking.hostName = "kyren-laptop"; - home-manager = { - extraSpecialArgs = { inherit inputs pkgs; }; - useUserPackages = true; - useGlobalPkgs = true; - users = { - "kyren" = import ./home.nix; - }; - }; + development.enable = true; + } diff --git a/modules/apps.nix b/modules/apps.nix new file mode 100644 index 0000000..401a21b --- /dev/null +++ b/modules/apps.nix @@ -0,0 +1,112 @@ +{ pkgs, lib, config, ... }: { + + options.apps.enable = lib.mkOption { + type = lib.types.bool; + default = true; + description = "enables apps"; + }; + + config = lib.mkIf config.apps.enable { + + programs.firefox.enable = true; + + environment.systemPackages = with pkgs; [ + # System + glib-networking + openssl + glibcLocales + libnotify + wl-clipboard + jdk + + libratbag # Mouse software (GHUB replacement) + piper # ^ GUI frontend + + # Utility + gimp + keepassxc + protonvpn-gui + (python312.withPackages (pypkgs: [ + pypkgs.matplotlib + pypkgs.pandas + pypkgs.pygithub + ])) + kdePackages.filelight + kdePackages.korganizer + kdePackages.kaddressbook + syncthingtray + libreoffice + albert + aseprite + cloudflare-warp + haruna + gparted + gnome-clocks + + # Communication + whatsie + vesktop + + # Terminal + ghostty + nerd-fonts.jetbrains-mono + oh-my-posh + tmux + neovim + tree-sitter + + # CLI + git + delta + gh + stow + eza + keychain + bc + bat + fd + ripgrep + wakatime-cli + fastfetch + btop + sqlite + unzip + fzf + zoxide + watchexec + gitleaks + rar + dig + minisign + libisoburn + ncdu + imagemagick + ghostscript # for imagemagick to support pdf files + xxd + duf + tldr + bottom + hyperfine # for benchmarking + wget + tectonic + mermaid-cli + ffmpeg + nh + ]; + + # VPN for Vault Hunters to avoid connection issues + # Note, will break discord, also tried proton VPN, still has conn issues + services.cloudflare-warp.enable = true; + + # Mouse config service (used with piper) + services.ratbagd.enable = true; + + # Install Docker (without using root access) + #virtualisation.docker.enable = true; + virtualisation.docker.rootless = { + enable = true; + setSocketVariable = true; + }; + + }; +} diff --git a/modules/development.nix b/modules/development.nix new file mode 100644 index 0000000..989444c --- /dev/null +++ b/modules/development.nix @@ -0,0 +1,66 @@ +{ pkgs, lib, config, ... }: { + + options.development.enable = lib.mkOption { + type = lib.types.bool; + default = false; + description = "enables development"; + }; + + config = lib.mkIf config.development.enable { + + environment.systemPackages = with pkgs; [ + jetbrains.idea-community + + # LSP + asm-lsp + astro-language-server + basedpyright + bash-language-server + vscode-langservers-extracted # html/css/json + gopls + lemminx # xml + lua-language-server + markdown-oxide + marksman + mdx-language-server + neocmakelsp + nil # nix + tailwindcss-language-server + taplo # toml + typescript-language-server + yaml-language-server + # pnpm i -g css-variables-language-server + # pnpm install -g gh-actions-language-server + + # Tools + stylua + gofumpt + golangci-lint + prettierd + jq + lldb # codelldb debugger + shellcheck + beautysh # shell formatter + gdb + nasm + rustup + tokei # count lines of code + go + pnpm + nodejs_24 + clang + clang-tools + gcc + gnumake + goose + sqlc + maven + gradle + kotlin + mold # fast linker, for rust + gomodifytags + sops + ]; + + }; +} diff --git a/modules/gaming.nix b/modules/gaming.nix new file mode 100644 index 0000000..f6a9c42 --- /dev/null +++ b/modules/gaming.nix @@ -0,0 +1,33 @@ +{ pkgs, lib, config, ... }: { + + options.gaming.enable = lib.mkOption { + type = lib.types.bool; + default = false; + description = "enables gaming"; + }; + + config = lib.mkIf config.gaming.enable { + + programs.steam = { + enable = true; + remotePlay.openFirewall = true; # Open ports in the firewall for Steam Remote Play + dedicatedServer.openFirewall = true; # Open ports in the firewall for Source Dedicated Server + localNetworkGameTransfers.openFirewall = true; # Open ports in the firewall for Steam Local Network Game Transfers + }; + + environment.systemPackages = with pkgs; [ + r2modman # For modded valheim + prismlauncher # mc + drawio # For VH + + (minecraft.overrideAttrs (finalAttrs: previousAttrs: { + meta.lib.broken = false; + })) + + kdePackages.kmines # Minesweeper for fun lol + kdePackages.kpat # Solitaire + # btw missing the card/brick thing with weird symbols, not sure what that game was called + ]; + + }; +} diff --git a/modules/packages.nix b/modules/packages.nix deleted file mode 100644 index 2b5b261..0000000 --- a/modules/packages.nix +++ /dev/null @@ -1,140 +0,0 @@ -{ pkgs, ... }: { - - environment.systemPackages = with pkgs; [ - glib-networking - openssl - clang - clang-tools - ghostty - glibcLocales - - nerd-fonts.jetbrains-mono - keepassxc - git - gh - delta - stow - eza - oh-my-posh - gcc - gnumake - neovim - fzf - zoxide - tmux - bc - keychain - bat - sqlite - fd - ripgrep - wakatime-cli - fastfetch - btop - protonvpn-gui - unzip - go - pnpm - nodejs_24 - (python312.withPackages (pypkgs: [ - pypkgs.matplotlib - pypkgs.pandas - pypkgs.pygithub - ])) - watchexec - golangci-lint - libnotify - wl-clipboard - whatsie - libratbag # Mouse software (GHUB replacement) - piper - goose - sqlc - jetbrains.idea-community - jdk - maven - gradle - kdePackages.filelight - kotlin - (minecraft.overrideAttrs (finalAttrs: previousAttrs: { - meta.lib.broken = false; - })) - rustup - tokei - kdePackages.kmines # Minesweeper for fun lol - kdePackages.kpat # Solitaire - # btw missing the card/brick thing with weird symbols, not sure what that game was called - gimp - kdePackages.korganizer - kdePackages.kaddressbook - gitleaks - rar - gomodifytags - sops - dig - syncthingtray - libreoffice - vesktop - nasm - albert - gdb - minisign - libisoburn - ncdu - imagemagick - ghostscript # for imagemagick to support pdf files - xxd - gnome-clocks - duf - tldr - bottom - hyperfine - nh - wget - mold - aseprite - prismlauncher - cloudflare-warp - drawio - tree-sitter - tectonic - mermaid-cli - ffmpeg - haruna - gparted - r2modman - openrgb-with-all-plugins - - # LSP - asm-lsp - astro-language-server - basedpyright - bash-language-server - vscode-langservers-extracted # html/css/json - gopls - lemminx - lua-language-server - markdown-oxide - marksman - mdx-language-server - neocmakelsp - nil - tailwindcss-language-server - taplo - typescript-language-server - yaml-language-server - # pnpm i -g css-variables-language-server - # pnpm install -g gh-actions-language-server - - # Tools - stylua - gofumpt - golangci-lint - prettierd - jq - lldb # codelldb debugger - shellcheck - beautysh # shell formatter - ]; - -} |
