9 Commits

Author SHA1 Message Date
John Lancaster
5d5b15fb63 singular lib.optional 2025-07-06 23:59:40 -05:00
John Lancaster
92067f8b69 using mkMerge now 2025-07-06 23:54:22 -05:00
John Lancaster
cc21dcdc92 added sublime and joplin options 2025-07-06 23:47:05 -05:00
John Lancaster
ac9e58ede6 fixed pathss 2025-07-06 23:11:25 -05:00
John Lancaster
be57ba16dd made plugin sciprt optional 2025-07-06 23:08:07 -05:00
John Lancaster
2fd6a2c04a moved keys 2025-07-06 23:07:54 -05:00
John Lancaster
09e941abbd broke out common logic 2025-07-06 21:52:22 -05:00
John Lancaster
e21c901e94 moved options together 2025-07-06 21:42:40 -05:00
John Lancaster
ce738ae612 started splitting up graphical programs because some of them don't really work well on ubuntu 2025-07-06 21:39:41 -05:00
10 changed files with 46 additions and 38 deletions

View File

@@ -76,8 +76,10 @@ nhmu
enableShell = true;
_1password = true;
docker = true;
graphical = true;
steam = true;
graphical = {
steam = true;
vscode = true;
};
extraImports = [
./home-manager/john.nix
./home-manager/gnome.nix

View File

@@ -22,7 +22,10 @@
# These will get applied to both the configured user and the root user (if enabled)
userOptions = config: {
openssh.authorizedKeys.keyFiles = lib.optionals config.ssh [ ./personal_keys ];
openssh.authorizedKeys = lib.mkIf config.ssh (lib.mkMerge [
(lib.mkIf (config.profile == "personal") { keyFiles = [ ./keys/personal ]; })
(lib.mkIf (config.profile == "work") { keyFiles = [ ./keys/work ]; })
]);
shell = lib.mkIf config.enableShell pkgs.zsh;
};
@@ -38,7 +41,6 @@
_1password = config._1password;
docker = config.docker;
graphical = config.graphical;
steam = config.steam;
}
] ++ config.extraImports;
@@ -54,14 +56,17 @@
inputs.home-manager.nixosModules.default
];
nix.settings.trusted-users = [ "root" "@wheel" ];
users.users.${config.user} = {
isNormalUser = true;
description = "John Lancaster";
extraGroups = []
++ lib.optionals config.root [ "wheel" ]
++ lib.optionals config.docker [ "docker" ]
++ lib.optionals config.networking.networkmanager.enable [ "networkmanager" ];
} // userOptions config;
users.users.${config.user} = lib.mkMerge [
{
isNormalUser = true;
description = "John Lancaster";
extraGroups = []
++ lib.optional config.root "wheel"
++ lib.optional config.docker "docker"
++ lib.optional config.networking.networkmanager.enable "networkmanager";
}
(userOptions config)
];
users.users.root = lib.mkIf config.root (userOptions config);
security.sudo-rs = lib.mkIf config.root {

View File

@@ -62,15 +62,10 @@
# # parentheses. Maybe you want to install Nerd Fonts with a limited number of
# # fonts?
# (pkgs.nerdfonts.override { fonts = [ "FantasqueSansMono" ]; })
] ++ lib.optionals config.graphical [
discord
spotify
sublime4
joplin-desktop
] ++ lib.optionals config._1password [
_1password-cli
gh # GitHub CLI with 1Password integration
];
]
++ lib.optional config.graphical.discord discord
++ lib.optional config.graphical.joplin joplin-desktop
++ lib.optional config.graphical.sublime sublime4;
# Home Manager can also manage your environment variables through
# 'home.sessionVariables'. These will be explicitly sourced when using a

View File

@@ -1,6 +1,6 @@
{ config, pkgs, lib, nixgl, ... }:
{
home.sessionVariables = lib.mkIf (config.enableShell && config.graphical) {
home.sessionVariables = lib.mkIf (config.enableShell && config.graphical.ghostty) {
TERMINAL = "ghostty";
};
@@ -9,7 +9,7 @@
nixGL.defaultWrapper = "mesa";
nixGL.installScripts = [ "mesa" ];
programs.ghostty = lib.mkIf (config.enableShell && config.graphical) {
programs.ghostty = lib.mkIf (config.enableShell && config.graphical.ghostty) {
enable = true;
enableZshIntegration = true;
package = config.lib.nixGL.wrap pkgs.ghostty;
@@ -52,7 +52,7 @@
};
# https://github.com/ghostty-org/ghostty/discussions/3763#discussioncomment-11699970
xdg.desktopEntries."com.mitchellh.ghostty" = lib.mkIf (config.enableShell && config.graphical) {
xdg.desktopEntries."com.mitchellh.ghostty" = lib.mkIf (config.enableShell && config.graphical.ghostty) {
name = "Ghostty";
type = "Application";
comment = "A terminal emulator";

View File

@@ -38,7 +38,9 @@
};
shellAliases.ls = "${pkgs.eza}/bin/eza -lgos type --no-time";
initContent = lib.mkIf config._1password ''
source ${config.home.homeDirectory}/.config/op/plugins.sh
if [ -f "${config.home.homeDirectory}/.config/op/plugins.sh" ]; then
source ${config.home.homeDirectory}/.config/op/plugins.sh
fi
'';
};
}

View File

@@ -1,6 +1,6 @@
{ config, lib, pkgs, ... }:
{
programs.vscode = lib.mkIf config.graphical {
programs.vscode = lib.mkIf config.graphical.vscode {
enable = true;
package = pkgs.vscode;
profiles.default.extensions = with pkgs.vscode-extensions; [

View File

@@ -60,15 +60,19 @@
description = "Whether to enable docker stuff";
};
options.graphical = lib.mkOption {
type = lib.types.bool;
default = false;
description = "Whether this system has a graphical environment";
};
options.steam = lib.mkOption {
type = lib.types.bool;
default = false;
description = "Whether this system has Steam installed";
};
options.graphical =
let
boolOption = lib.mkOption {
type = lib.types.bool;
default = false;
};
in
{
discord = boolOption;
ghostty = boolOption;
joplin = boolOption;
steam = boolOption;
sublime = boolOption;
vscode = boolOption;
};
}

View File

@@ -1,6 +1,6 @@
{ config, pkgs, lib, ... }:
{
programs.steam = lib.mkIf config.steam {
programs.steam = lib.mkIf config.graphical.steam {
enable = true;
gamescopeSession.enable = true;
remotePlay.openFirewall = true; # Open ports in the firewall for Steam Remote Play