From d01e11491460a79e8ae6c0f77b38620835bded3d Mon Sep 17 00:00:00 2001 From: GarandPLG Date: Thu, 18 Sep 2025 16:56:59 +0200 Subject: [PATCH] =?UTF-8?q?refaktoryzacja=20flake.nix,=20aby=20wspiera?= =?UTF-8?q?=C5=82=20wielu=20host=C3=B3w,=20a=20nie=20tylko=20jednego=20wpi?= =?UTF-8?q?sanego=20na=20twardo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- flake.nix | 28 +++--- hosts/Garand-Desktop/variables.nix | 21 +++-- hosts/default/variables.nix | 33 +++---- modules/home/bash-aliases.nix | 12 +-- modules/home/fastfetch/default.nix | 137 ----------------------------- 5 files changed, 49 insertions(+), 182 deletions(-) diff --git a/flake.nix b/flake.nix index 1ff7462..bef7c05 100644 --- a/flake.nix +++ b/flake.nix @@ -35,14 +35,18 @@ ... }@inputs: let - system = "x86_64-linux"; - host = "Garand-Desktop"; - profile = "nvidia"; - username = "garand_plg"; + hostDirs = builtins.attrNames (builtins.readDir ./hosts); - # Deduplicate nixosConfigurations while preserving the top-level 'profile' - mkNixosConfig = - gpuProfile: + mkHost = + hostName: + let + inherit (import ./hosts/${hostName}/variables.nix) + host + username + profile + system + ; + in nixpkgs.lib.nixosSystem { inherit system; specialArgs = { @@ -53,18 +57,12 @@ inherit system; }; modules = [ - ./profiles/${gpuProfile} + ./profiles/${profile} nix-flatpak.nixosModules.nix-flatpak ]; }; in { - nixosConfigurations = { - amd = mkNixosConfig "amd"; - nvidia = mkNixosConfig "nvidia"; - nvidia-laptop = mkNixosConfig "nvidia-laptop"; - intel = mkNixosConfig "intel"; - vm = mkNixosConfig "vm"; - }; + nixosConfigurations = nixpkgs.lib.genAttrs hostDirs mkHost; }; } diff --git a/hosts/Garand-Desktop/variables.nix b/hosts/Garand-Desktop/variables.nix index e70121b..4f03323 100644 --- a/hosts/Garand-Desktop/variables.nix +++ b/hosts/Garand-Desktop/variables.nix @@ -1,14 +1,20 @@ { + # CPU Architecture + # Available options: "x86_64-linux", "aarch64-linux", etc. + system = "x86_64-linux"; + + # Host Configuration + host = "Garand-Desktop"; + username = "garand_plg"; + + # GPU Profile + # Available options: "amd", "nvidia", "nvidia-laptop", "intel", "vm" + profile = "nvidia"; + # Git Configuration ( For Pulling Software Repos ) gitUsername = "GarandPLG"; gitEmail = "garandplg@garandplg.com"; - # Set Displau Manager - # `tui` for Text login - # `sddm` for graphical GUI (default) - # SDDM background is set with stylixImage - displayManager = "tui"; - # Hyprland Settings # Examples: # extraMonitorSettings = "monitor = Virtual-1,1920x1080@60,auto,1"; @@ -27,9 +33,6 @@ # or as a flatpak browser = "librewolf"; - # Available Options: - # Kitty, ghostty, wezterm, aalacrity - # Note: kitty, wezterm, alacritty have to be enabled in `variables.nix` # Setting it here does not enable it. Kitty is installed by default terminal = "kitty"; # Set Default System Terminal diff --git a/hosts/default/variables.nix b/hosts/default/variables.nix index 690be83..f4405bf 100644 --- a/hosts/default/variables.nix +++ b/hosts/default/variables.nix @@ -1,13 +1,19 @@ { - # Git Configuration ( For Pulling Software Repos ) - gitUsername = "Tyler Kelley"; - gitEmail = "tylerzanekelley@gmail.com"; + # CPU Architecture + # Available options: "x86_64-linux", "aarch64-linux", etc. + system = "x86_64-linux"; - # Set Displau Manager - # `tui` for Text login - # `sddm` for graphical GUI (default) - # SDDM background is set with stylixImage - displayManager = "sddm"; + # Host Configuration + host = "My-Desktop"; + username = "my_username"; + + # GPU Profile + # Available options: "amd", "nvidia", "nvidia-laptop", "intel", "vm" + profile = "nvidia"; + + # Git Configuration ( For Pulling Software Repos ) + gitUsername = "GarandPLG"; + gitEmail = "my@email.com"; # Hyprland Settings # Examples: @@ -20,23 +26,20 @@ "; # Waybar Settings - clock24h = false; + clock24h = true; # Program Options # Set Default Browser (google-chrome-stable for google-chrome) # This does NOT install your browser # You need to install it by adding it to the `packages.nix` # or as a flatpak - browser = "brave"; + browser = "librewolf"; - # Available Options: - # Kitty, ghostty, wezterm, aalacrity - # Note: kitty, wezterm, alacritty have to be enabled in `variables.nix` # Setting it here does not enable it. Kitty is installed by default terminal = "kitty"; # Set Default System Terminal - keyboardLayout = "us"; - consoleKeyMap = "us"; + keyboardLayout = "pl"; + consoleKeyMap = "pl"; # For Nvidia Prime support intelID = "PCI:1:0:0"; diff --git a/modules/home/bash-aliases.nix b/modules/home/bash-aliases.nix index e419497..943327c 100644 --- a/modules/home/bash-aliases.nix +++ b/modules/home/bash-aliases.nix @@ -1,13 +1,13 @@ -{ profile, ... }: +{ host, ... }: { programs.bash = { shellAliases = { # NixOS aliases - upd = "nh os switch --hostname ${profile}"; - upg = "nh os switch --hostname ${profile} --update"; - upd-bt = "nh os boot --hostname ${profile}"; - upd-ts = "nh os test --hostname ${profile}"; - upd-bd = "nh os build --hostname ${profile}"; + upd = "nh os switch --hostname ${host}"; + upg = "nh os switch --hostname ${host} --update"; + upd-bt = "nh os boot --hostname ${host}"; + upd-ts = "nh os test --hostname ${host}"; + upd-bd = "nh os build --hostname ${host}"; ncg = "nix-collect-garbage --delete-old && sudo nix-collect-garbage -d && sudo /run/current-system/bin/switch-to-configuration boot"; # Development aliases diff --git a/modules/home/fastfetch/default.nix b/modules/home/fastfetch/default.nix index d60fdda..6d30ecd 100644 --- a/modules/home/fastfetch/default.nix +++ b/modules/home/fastfetch/default.nix @@ -1,140 +1,3 @@ -# { -# programs.fastfetch = { -# enable = true; - -# settings = { -# display = { -# color = { -# keys = "35"; -# output = "95"; -# }; -# separator = " ➜ "; -# }; - -# logo = { -# source = ./garandos.png; -# type = "kitty-direct"; -# height = 10; -# width = 20; -# padding = { -# top = 2; -# left = 2; -# }; -# }; - -# modules = [ -# "break" -# { -# type = "os"; -# key = "OS"; -# keyColor = "31"; -# } -# { -# type = "command"; -# key = " ├  GarandOS "; -# keyColor = "31"; -# text = "echo v$" + "{GARANDOS_VERSION}"; -# } -# { -# type = "kernel"; -# key = " ├  "; -# keyColor = "31"; -# } -# { -# type = "packages"; -# key = " ├ 󰏖 "; -# keyColor = "31"; -# } -# { -# type = "shell"; -# key = " └  "; -# keyColor = "31"; -# } -# "break" -# { -# type = "wm"; -# key = "WM "; -# keyColor = "32"; -# } -# { -# type = "wmtheme"; -# key = " ├ 󰉼 "; -# keyColor = "32"; -# } -# { -# type = "icons"; -# key = " ├ 󰀻 "; -# keyColor = "32"; -# } -# { -# type = "cursor"; -# key = " ├  "; -# keyColor = "32"; -# } -# { -# type = "terminal"; -# key = " ├  "; -# keyColor = "32"; -# } -# { -# type = "terminalfont"; -# key = " └  "; -# keyColor = "32"; -# } -# "break" -# { -# type = "host"; -# format = "{5} {1} Type {2}"; -# key = "PC "; -# keyColor = "33"; -# } -# { -# type = "cpu"; -# format = "{1} ({3}) @ {7} GHz"; -# key = " ├  "; -# keyColor = "33"; -# } -# { -# type = "gpu"; -# format = "{1} {2} @ {12} GHz"; -# key = " ├ 󰢮 "; -# keyColor = "33"; -# } -# { -# type = "memory"; -# key = " ├  "; -# keyColor = "33"; -# } -# { -# type = "disk"; -# key = " ├ 󰋊 "; -# keyColor = "33"; -# } -# { -# type = "monitor"; -# key = " ├  "; -# keyColor = "33"; -# } -# { -# type = "player"; -# key = " ├ 󰥠 "; -# keyColor = "33"; -# } -# { -# type = "media"; -# key = " └ 󰝚 "; -# keyColor = "33"; -# } -# "break" -# { -# type = "uptime"; -# key = " Uptime "; -# } -# ]; -# }; -# }; -# } - { programs.fastfetch = { enable = true;