1
0
forked from extern/zaneyos

Move to using options.nix for user and system settings

This commit is contained in:
Tyler Kelley 2024-02-05 21:46:24 -06:00
parent 3c4f6d6433
commit 035f18c2f3
17 changed files with 82 additions and 74 deletions

View File

@ -1,5 +1,6 @@
{ config, pkgs, flakeDir, ... }: { config, pkgs, ... }:
let inherit (import ../../options.nix) flakeDir; in
{ {
# Configure Bash # Configure Bash
programs.bash = { programs.bash = {

View File

@ -1,10 +1,12 @@
{ pkgs, config, lib, browser, { pkgs, config, lib, inputs, ... }:
cpuType, gpuType, wallpaperDir,
inputs, borderAnim, theKBDLayout, ... }:
let let
theme = config.colorScheme.palette; theme = config.colorScheme.palette;
hyprplugins = inputs.hyprland-plugins.packages.${pkgs.system}; hyprplugins = inputs.hyprland-plugins.packages.${pkgs.system};
inherit (import ../../options.nix)
browser cpuType gpuType
wallpaperDir borderAnim
theKBDLayout;
in with lib; { in with lib; {
wayland.windowManager.hyprland = { wayland.windowManager.hyprland = {
enable = true; enable = true;

View File

@ -1,7 +1,9 @@
{ pkgs, config, browser, wallpaperDir, flakeDir, { pkgs, config, username, ... }:
username, wallpaperGit, ... }:
{ let
inherit (import ../../options.nix)
browser wallpaperDir wallpaperGit flakeDir;
in {
# Install Packages For The User # Install Packages For The User
home.packages = with pkgs; [ home.packages = with pkgs; [
pkgs."${browser}" discord libvirt swww grim slurp gnome.file-roller pkgs."${browser}" discord libvirt swww grim slurp gnome.file-roller

View File

@ -1,7 +1,8 @@
{ pkgs, config, lib, waybarStyle, ... }: { pkgs, config, lib, ... }:
let let
palette = config.colorScheme.palette; palette = config.colorScheme.palette;
inherit (import ../../options.nix) waybarStyle;
in in
lib.mkIf ("${waybarStyle}" == "style1") { lib.mkIf ("${waybarStyle}" == "style1") {
# Configure & Theme Waybar # Configure & Theme Waybar

View File

@ -2,6 +2,7 @@
let let
palette = config.colorScheme.palette; palette = config.colorScheme.palette;
inherit (import ../../options.nix) waybarStyle;
in in
lib.mkIf ("${waybarStyle}" == "style2") { lib.mkIf ("${waybarStyle}" == "style2") {
# Configure & Theme Waybar # Configure & Theme Waybar

View File

@ -1,5 +1,6 @@
{ pkgs, config, lib, gpuType, ... }: { pkgs, config, lib, ... }:
let inherit (import ../../options.nix) gpuType; in
lib.mkIf ("${gpuType}" == "amd") { lib.mkIf ("${gpuType}" == "amd") {
systemd.tmpfiles.rules = [ systemd.tmpfiles.rules = [
"L+ /opt/rocm/hip - - - - ${pkgs.rocmPackages.clr}" "L+ /opt/rocm/hip - - - - ${pkgs.rocmPackages.clr}"

View File

@ -1,6 +1,6 @@
{ pkgs, config, wallpaperDir, { pkgs, config, username, ... }:
wallpaperGit, username, ... }:
let inherit (import ../../options.nix) wallpaperDir wallpaperGit; in
{ {
# system.userActivationScripts = { # system.userActivationScripts = {
# gitwallpapers.text = '' # gitwallpapers.text = ''

View File

@ -1,5 +1,6 @@
{ pkgs, config, theKBDLayout, ... }: { pkgs, config, ... }:
let inherit (import ../../options.nix) theKBDLayout; in
{ {
services.xserver = { services.xserver = {
enable = true; enable = true;

View File

@ -1,5 +1,6 @@
{ pkgs, config, lib, gpuType, ... }: { pkgs, config, lib, ... }:
let inherit (import ../../options.nix) gpuType; in
lib.mkIf ("${gpuType}" == "intel-amd") { lib.mkIf ("${gpuType}" == "intel-amd") {
nixpkgs.config.packageOverrides = nixpkgs.config.packageOverrides =
pkgs: { pkgs: {

View File

@ -1,5 +1,6 @@
{ pkgs, config, lib, gpuType, ... }: { pkgs, config, lib, ... }:
let inherit (import ../../options.nix) gpuType; in
lib.mkIf ("${gpuType}" == "intel") { lib.mkIf ("${gpuType}" == "intel") {
nixpkgs.config.packageOverrides = nixpkgs.config.packageOverrides =
pkgs: { pkgs: {

View File

@ -1,6 +1,6 @@
{ pkgs, config, lib, gpuType, { pkgs, config, lib, ... }:
intel-bus-id, nvidia-bus-id, ... }:
let inherit (import ../../options.nix) intel-bus-id nvidia-bus-id gpuType; in
lib.mkIf ("${gpuType}" == "intel-nvidia") { lib.mkIf ("${gpuType}" == "intel-nvidia") {
nixpkgs.config.packageOverrides = nixpkgs.config.packageOverrides =
pkgs: { pkgs: {

View File

@ -1,5 +1,6 @@
{ pkgs, config, lib, gpuType, ... }: { pkgs, config, lib, gpuType, ... }:
let inherit (import ../../options.nix) gpuType; in
lib.mkIf ("${gpuType}" == "nvidia") { lib.mkIf ("${gpuType}" == "nvidia") {
services.xserver.videoDrivers = ["nvidia"]; services.xserver.videoDrivers = ["nvidia"];
hardware.nvidia = { hardware.nvidia = {

View File

@ -1,5 +1,6 @@
{ pkgs, config, lib, cpuType, ... }: { pkgs, config, lib, ... }:
let inherit (import ../../options.nix) cpuType; in
lib.mkIf ("${cpuType}" == "vm") { lib.mkIf ("${cpuType}" == "vm") {
services.qemuGuest.enable = true; services.qemuGuest.enable = true;
services.spice-vdagentd.enable = true; services.spice-vdagentd.enable = true;

View File

@ -20,34 +20,8 @@
outputs = inputs@{ nixpkgs, home-manager, ... }: outputs = inputs@{ nixpkgs, home-manager, ... }:
let let
system = "x86_64-linux"; system = "x86_64-linux";
# User Variables
hostname = "hyprnix";
username = "zaney"; username = "zaney";
gitUsername = "Tyler Kelley"; hostname = "hyprnix";
gitEmail = "tylerzanekelley@gmail.com";
theLocale = "en_US.UTF-8";
theKBDLayout = "us";
theLCVariables = "en_US.UTF-8";
theTimezone = "America/Chicago";
theme = "rose-pine";
waybarStyle = "style2"; # can be style1-2
borderAnim = "on"; # anything other than on disables anim borders in Hyprland
browser = "firefox";
wallpaperGit = "https://gitlab.com/Zaney/my-wallpapers.git";
wallpaperDir = "/home/${username}/Pictures/Wallpapers";
flakeDir = "/home/${username}/zaneyos";
# Driver selection profile
# Options include amd (tested), intel, nvidia
# GPU hybrid options: intel-nvidia, intel-amd
# vm for both if you are running a vm
cpuType = "intel";
gpuType = "amd";
# Run: sudo lshw -c display to find this info
# This is needed ONLY for hybrid nvidia offloading
# Run: nvidia-offload (insert program name)
intel-bus-id = "PCI:0:2:0";
nvidia-bus-id = "PCI:14:0:0";
pkgs = import nixpkgs { pkgs = import nixpkgs {
inherit system; inherit system;
@ -58,34 +32,23 @@
in { in {
nixosConfigurations = { nixosConfigurations = {
"${hostname}" = nixpkgs.lib.nixosSystem { "${hostname}" = nixpkgs.lib.nixosSystem {
specialArgs = { specialArgs = {
inherit system; inherit inputs; inherit system; inherit inputs;
inherit username; inherit hostname; inherit username; inherit hostname;
inherit gitUsername; inherit theTimezone;
inherit gitEmail; inherit theLocale;
inherit wallpaperDir; inherit wallpaperGit;
inherit cpuType; inherit theKBDLayout;
inherit theLCVariables; inherit gpuType;
inherit theme;
}; };
modules = [ ./system.nix modules = [
./system.nix
home-manager.nixosModules.home-manager { home-manager.nixosModules.home-manager {
home-manager.extraSpecialArgs = { inherit username; home-manager.extraSpecialArgs = {
inherit gitUsername; inherit gitEmail; inherit username; inherit inputs;
inherit theKBDLayout; inherit inputs;
inherit theme; inherit browser;
inherit wallpaperDir; inherit wallpaperGit;
inherit flakeDir; inherit gpuType;
inherit cpuType; inherit waybarStyle;
inherit borderAnim;
inherit (inputs.nix-colors.lib-contrib {inherit pkgs;}) gtkThemeFromScheme; inherit (inputs.nix-colors.lib-contrib {inherit pkgs;}) gtkThemeFromScheme;
}; };
home-manager.useGlobalPkgs = true; home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true; home-manager.useUserPackages = true;
home-manager.backupFileExtension = "backup"; home-manager.backupFileExtension = "backup";
home-manager.users.${username} = import ./home.nix; home-manager.users.${username} = import ./home.nix;
} }
]; ];
}; };
}; };
}; };

View File

@ -1,9 +1,11 @@
{ config, pkgs, inputs, username, { config, pkgs, inputs, username,
gitUsername, gitEmail, gtkThemeFromScheme, gtkThemeFromScheme, ... }:
theme, browser, wallpaperDir, wallpaperGit, let
flakeDir, waybarStyle, ... }: inherit (import ./options.nix)
gitUsername gitEmail theme browser
{ wallpaperDir wallpaperGit flakeDir
waybarStyle;
in {
# Home Manager Settings # Home Manager Settings
home.username = "${username}"; home.username = "${username}";
home.homeDirectory = "/home/${username}"; home.homeDirectory = "/home/${username}";

27
options.nix Normal file
View File

@ -0,0 +1,27 @@
{
# User Variables
gitUsername = "Tyler Kelley";
gitEmail = "tylerzanekelley@gmail.com";
theLocale = "en_US.UTF-8";
theKBDLayout = "us";
theLCVariables = "en_US.UTF-8";
theTimezone = "America/Chicago";
theme = "rose-pine";
waybarStyle = "style2"; # can be style1-2
borderAnim = "on"; # anything other than on disables anim borders in Hyprland
browser = "firefox";
wallpaperGit = "https://gitlab.com/Zaney/my-wallpapers.git";
wallpaperDir = "/home/zaney/Pictures/Wallpapers";
flakeDir = "/home/zaney/zaneyos";
# Driver selection profile
# Options include amd (tested), intel, nvidia
# GPU hybrid options: intel-nvidia, intel-amd
# vm for both if you are running a vm
cpuType = "intel";
gpuType = "amd";
# Run: sudo lshw -c display to find this info
# This is needed ONLY for hybrid nvidia offloading
# Run: nvidia-offload (insert program name)
intel-bus-id = "PCI:0:2:0";
nvidia-bus-id = "PCI:14:0:0";
}

View File

@ -1,9 +1,12 @@
{ inputs, config, pkgs, username, { inputs, config, pkgs,
hostname, gitUsername, theLocale, username, hostname, ... }:
theTimezone, wallpaperDir, wallpaperGit,
theLCVariables, theKBDLayout, ... }:
{ let
inherit (import ./options.nix)
theLocale theTimezone gitUsername
wallpaperDir wallpaperGit
theLCVariables theKBDLayout;
in {
imports = imports =
[ [
inputs.nixvim.nixosModules.nixvim inputs.nixvim.nixosModules.nixvim