refaktoryzacja flake.nix, aby wspierał wielu hostów, a nie tylko jednego wpisanego na twardo

This commit is contained in:
2025-09-18 16:56:59 +02:00
parent 0908e9eed6
commit d01e114914
5 changed files with 49 additions and 182 deletions

View File

@@ -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;
};
}

View File

@@ -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

View File

@@ -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";

View File

@@ -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

View File

@@ -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;