From 8fd3ca8c9a017bacef7ec714b30ea4020801ecf1 Mon Sep 17 00:00:00 2001 From: "Wyatt J. Miller" Date: Thu, 30 Oct 2025 17:34:55 -0400 Subject: [PATCH] wip: modularizing? --- flake.nix | 21 ++++++++- home/browser.nix | 3 +- home/default.nix | 85 +++++++++++++++++++---------------- home/packages/common.nix | 23 +--------- home/packages/workstation.nix | 19 ++++++++ lib/checkSystem.nix | 0 6 files changed, 89 insertions(+), 62 deletions(-) create mode 100644 lib/checkSystem.nix diff --git a/flake.nix b/flake.nix index 453d977..36f254f 100644 --- a/flake.nix +++ b/flake.nix @@ -61,7 +61,8 @@ { home-manager.useGlobalPkgs = true; home-manager.useUserPackages = true; - home-manager.extraSpecialArgs = extraSpecialArgs; + home-manager.extraSpecialArgs = extraSpecialArgs // { isNixOS = false; }; + # home-manager.extraSpecialArgs = extraSpecialArgs; home-manager.backupFileExtension = "bak"; home-manager.users.${userName} = import ./home; } @@ -150,5 +151,23 @@ # } # ]; }; + + # generic non-NixOS Linux machine + homeConfigurations."generic" = let + hostname = builtins.getEnv "HOSTNAME"; + pkgs = nixpkgs.legacyPackages.x86_64-linux; + in home-manager.lib.homeManagerConfiguration { + inherit pkgs; + # system = "x86_64-linux"; + extraSpecialArgs = extraSpecialArgs // { + isNixOS = false; + hostname = hostname; + }; + modules = [ + myOverlays + ./modules/common/core + ./home + ]; + }; }; } diff --git a/home/browser.nix b/home/browser.nix index 9cd69e9..953775c 100644 --- a/home/browser.nix +++ b/home/browser.nix @@ -1,6 +1,7 @@ { pkgs, lib, + isNixOS, ... }: { programs.firefox = { @@ -9,7 +10,7 @@ }; programs.chromium = { - enable = pkgs.stdenv.isLinux; + enable = pkgs.stdenv.isLinux && isNixOS; package = pkgs.ungoogled-chromium.override { enableWideVine = true; commandLineArgs = [ diff --git a/home/default.nix b/home/default.nix index 19219a2..5283664 100644 --- a/home/default.nix +++ b/home/default.nix @@ -1,19 +1,20 @@ -{ - lib, - pkgs, - userName, - userEmail, - ghostty, - ... -}: let - # Have a file sturcture that holds all the configuration files that can't be configured by Nix - # or maybe I'm too lazy to do anything about it? I dunno +{ lib +, pkgs +, userName +, userEmail +, ghostty +, isNixOS ? true +, ... +}: +let + # Have a file structure that holds all the configuration files that can't be configured by Nix dirs = { defaults = ../defaults; }; -in { +in +{ # Import sub modules - imports = map (module: import module {inherit lib pkgs dirs userName userEmail ghostty;}) [ + imports = map (module: import module { inherit lib pkgs dirs userName userEmail ghostty isNixOS; }) [ ./atuin.nix ./shell.nix ./packages @@ -22,43 +23,49 @@ in { ./eza.nix ./neovim.nix ./direnv.nix - ./sway.nix + # ./sway.nix ./terminal.nix ./browser.nix ./zellij.nix ./bat.nix ./lazygit.nix + ] ++ lib.optionalattrs isNixOS [ + ./sway.nix ]; - # Home Manager needs a bit of information about you and the - # paths it should manage. - home = { - username = userName; - homeDirectory = - if pkgs.stdenv.isDarwin - then "/Users/${userName}" - else "/home/${userName}"; + home = lib.mkMerge [ + { + username = userName; + homeDirectory = + if pkgs.stdenv.isDarwin + then "/Users/${userName}" + else "/home/${userName}"; - sessionVariables = { - XDG_CURRENT_DESKTOP = "sway"; - XDG_SESSION_TYPE = "wayland"; - XDG_SESSION_DESKTOP="sway"; - XDG_CONFIG_HOME = "$HOME/.config"; - XDG_CACHE_HOME = "$HOME/.cache"; - XDG_DATA_HOME = "$HOME/.local/share"; - XDG_STATE_HOME = "$HOME/.local/state"; - NIXOS_OZONE_WL = "1"; - }; + stateVersion = "24.11"; + } - pointerCursor = lib.mkIf pkgs.stdenv.isLinux { - gtk.enable = true; - package = pkgs.catppuccin-cursors.mochaDark; - name = "catppuccin-mocha-dark-cursors"; - size = 22; - }; + (lib.mkIf isNixOS { + sessionVariables = { + XDG_CURRENT_DESKTOP = "sway"; + XDG_SESSION_TYPE = "wayland"; + XDG_SESSION_DESKTOP = "sway"; + XDG_CONFIG_HOME = "$HOME/.config"; + XDG_CACHE_HOME = "$HOME/.cache"; + XDG_DATA_HOME = "$HOME/.local/share"; + XDG_STATE_HOME = "$HOME/.local/state"; + NIXOS_OZONE_WL = "1"; + }; + }) - stateVersion = "24.11"; - }; + (lib.mkIf pkgs.stdenv.isLinux { + pointerCursor = { + gtk.enable = true; + package = pkgs.catppuccin-cursors.mochaDark; + name = "catppuccin-mocha-dark-cursors"; + size = 22; + }; + }) + ]; # Let Home Manager install and manage itself. programs.home-manager.enable = true; diff --git a/home/packages/common.nix b/home/packages/common.nix index b43311a..abbe5fd 100644 --- a/home/packages/common.nix +++ b/home/packages/common.nix @@ -3,8 +3,6 @@ ... }: { home.packages = with pkgs; [ - yazi # terminal file manager - # archives zip xz @@ -12,39 +10,22 @@ p7zip # utils + yazi tmux bottom ripgrep jq yq-go fzf - fh aria2 - yt-dlp - obsidian - vscode - weechat + gnupg inetutils # misc - cowsay file which tree gnutar - gnupg - zoxide babelfish - - # language-specific package managers - nodejs - cargo - python3 - - # nix specific stuff - nixd - deadnix - alejandra - statix ]; } diff --git a/home/packages/workstation.nix b/home/packages/workstation.nix index e69de29..0d0454f 100644 --- a/home/packages/workstation.nix +++ b/home/packages/workstation.nix @@ -0,0 +1,19 @@ +{ + pkgs, + ... +}: { + home.packages = with pkgs; [ + fh + obsidian + vscode + yt-dlp + weechat + nodejs + cargo + python3 + nixd + deadnix + alejandra + statix + ]; +} diff --git a/lib/checkSystem.nix b/lib/checkSystem.nix new file mode 100644 index 0000000..e69de29