Allow disabling home-manager parts for server

This commit is contained in:
Tyler Beckman 2024-12-11 20:09:53 -07:00
parent 7c9307a2cf
commit 6d0e03dbcf
Signed by: Ty
GPG key ID: 2813440C772555A4
15 changed files with 195 additions and 170 deletions

View file

@ -68,6 +68,16 @@
# Home manager # Home manager
home-manager.nixosModules.home-manager home-manager.nixosModules.home-manager
./home-manager ./home-manager
{
ty-home-manager-options = {
plasma.enable = true;
beets.enable = true;
firefox.enable = true;
thunderbird.enable = true;
rescrobbled.enable = true;
vscode.enable = true;
};
}
]; ];
specialArgs = { specialArgs = {
@ -84,28 +94,25 @@
# Better command-not-found # Better command-not-found
nix-index-database.nixosModules.nix-index nix-index-database.nixosModules.nix-index
{ programs.nix-index-database.comma.enable = true; } { programs.nix-index-database.comma.enable = true; }
# Home manager
home-manager.nixosModules.home-manager
./home-manager
{
ty-home-manager-options = {
plasma.enable = false;
beets.enable = false;
firefox.enable = false;
thunderbird.enable = false;
rescrobbled.enable = false;
vscode.enable = false;
};
}
]; ];
specialArgs = { specialArgs = {
inherit inputs system secrets; inherit inputs system secrets;
}; };
}; };
# Add home manager configuration compatibility to the main flake
homeConfigurations."ty" = home-manager.lib.homeManagerConfiguration {
inherit pkgs;
# Specify your home configuration modules here, for example,
# the path to your home.nix.
modules = [
plasma-manager.homeManagerModules.plasma-manager
./home-manager/custom-modules
./home-manager/home.nix
];
extraSpecialArgs = {
inherit inputs system secrets;
};
};
}; };
} }

View file

@ -1,19 +1,31 @@
{ inputs, system, secrets, ... }: { inputs, system, secrets, lib, config, ... }:
{ {
home-manager.useGlobalPkgs = true; options.ty-home-manager-options = {
home-manager.useUserPackages = true; plasma.enable = lib.mkEnableOption "plasma configuration";
home-manager.sharedModules = [ firefox.enable = lib.mkEnableOption "firefox configuration";
inputs.plasma-manager.homeManagerModules.plasma-manager thunderbird.enable = lib.mkEnableOption "thunderbird configuration";
./custom-modules vscode.enable = lib.mkEnableOption "vscode configuration";
]; beets.enable = lib.mkEnableOption "beets configuration";
home-manager.extraSpecialArgs = { rescrobbled.enable = lib.mkEnableOption "rescrobbled configuration";
inherit inputs system secrets;
}; };
home-manager.backupFileExtension = "backup";
home-manager.users.ty = { config = {
imports = [ home-manager.useGlobalPkgs = true;
./home.nix home-manager.useUserPackages = true;
home-manager.sharedModules = [
inputs.plasma-manager.homeManagerModules.plasma-manager
./custom-modules
]; ];
home-manager.extraSpecialArgs = {
inherit inputs system secrets;
inherit (config) ty-home-manager-options;
};
home-manager.backupFileExtension = "backup";
home-manager.users.ty = {
imports = [
./home.nix
];
};
}; };
} }

View file

@ -1,4 +1,4 @@
{ ... }: { lib, config, ... }:
{ {
home.stateVersion = "24.05"; home.stateVersion = "24.05";
home.username = "ty"; home.username = "ty";

View file

@ -1,4 +1,4 @@
{ ... }: { lib, config, ... }:
{ {
imports = [ imports = [
./email.nix ./email.nix

View file

@ -1,6 +1,6 @@
{ ... }: { lib, ty-home-manager-options, ... }:
{ {
accounts.email.accounts = { accounts.email.accounts = lib.mkIf ty-home-manager-options.thunderbird.enable {
PurelyMail = rec { PurelyMail = rec {
realName = "Tyler Beckman"; realName = "Tyler Beckman";
address = "ty@myriation.xyz"; address = "ty@myriation.xyz";

View file

@ -1,6 +1,6 @@
{ lib, secrets, ... }: { lib, secrets, ty-home-manager-options, ... }:
{ {
programs.beets = { programs.beets = lib.mkIf ty-home-manager-options.beets.enable {
enable = true; enable = true;
settings = { settings = {

View file

@ -1,6 +1,6 @@
{ ... }: { lib, ty-home-manager-options, ... }:
{ {
xdg.desktopEntries = { xdg.desktopEntries = lib.mkIf ty-home-manager-options.plasma.enable {
# Override vesktop for matching icon in beautyline (make it generic discord icon) # Override vesktop for matching icon in beautyline (make it generic discord icon)
vesktop = { vesktop = {
categories = [ "Network" "InstantMessaging" "Chat" ]; categories = [ "Network" "InstantMessaging" "Chat" ];

View file

@ -1,6 +1,6 @@
{ pkgs, inputs, system, ... }: { pkgs, inputs, system, lib, ty-home-manager-options, ... }:
{ {
programs.firefox = { programs.firefox = lib.mkIf ty-home-manager-options.firefox.enable {
enable = true; enable = true;
policies = { policies = {
ExtensionSettings = { ExtensionSettings = {

View file

@ -1,25 +1,27 @@
{ pkgs, config, ... }: { pkgs, lib, config, ty-home-manager-options, ... }:
{ {
gtk = { config = lib.mkIf ty-home-manager-options.plasma.enable {
enable = true; gtk = {
enable = true;
gtk2.configLocation = "${config.xdg.configHome}/gtk-2.0/gtkrc"; gtk2.configLocation = "${config.xdg.configHome}/gtk-2.0/gtkrc";
theme = { theme = {
name = "Breeze-Dark"; name = "Breeze-Dark";
package = pkgs.kdePackages.breeze-gtk; package = pkgs.kdePackages.breeze-gtk;
}; };
cursorTheme = { cursorTheme = {
name = "Vimix-cursors"; name = "Vimix-cursors";
package = pkgs.vimix-cursors; package = pkgs.vimix-cursors;
size = 24; size = 24;
}; };
iconTheme = { iconTheme = {
name = "beautyline-garuda"; name = "beautyline-garuda";
package = (pkgs.callPackage ../../packages/beautyline {}); package = (pkgs.callPackage ../../packages/beautyline {});
};
}; };
# Tell home-manager to force overwrite the gtk2 configuration as it keeps getting overwritten by something (likely plasma)
home.file.${config.gtk.gtk2.configLocation}.force = true;
}; };
# Tell home-manager to force overwrite the gtk2 configuration as it keeps getting overwritten by something (likely plasma)
home.file.${config.gtk.gtk2.configLocation}.force = true;
} }

View file

@ -1,4 +1,4 @@
{ pkgs, inputs, system, ... }: { pkgs, inputs, system, ty-home-manager-options, ... }:
{ {
home.packages = (with pkgs; [ home.packages = (with pkgs; [
# Documents # Documents

View file

@ -1,6 +1,6 @@
{ pkgs, ... }: { pkgs, lib, ty-home-manager-options, ... }:
{ {
programs.plasma = { programs.plasma = lib.mkIf ty-home-manager-options.plasma.enable {
enable = true; enable = true;
workspace = { workspace = {

View file

@ -1,21 +1,23 @@
{ secrets, lib, ... }: { secrets, lib, ty-home-manager-options, ... }:
{ {
services.custom.rescrobbled = let s = secrets.programs.rescrobbled; in lib.mkIf s.enable { config = lib.mkIf ty-home-manager-options.rescrobbled.enable {
enable = true; services.custom.rescrobbled = let s = secrets.programs.rescrobbled; in lib.mkIf s.enable {
enable = true;
session = s.lastfm.session; session = s.lastfm.session;
settings = { settings = {
player-whitelist = [ "elisa" ]; player-whitelist = [ "elisa" ];
listenbrainz = lib.mkIf (s.listenbrainz.token != null) [ listenbrainz = lib.mkIf (s.listenbrainz.token != null) [
{ {
token = s.listenbrainz.token; token = s.listenbrainz.token;
} }
]; ];
lastfm-key = lib.mkIf (s.lastfm.key != null && s.lastfm.secret != null) s.lastfm.key; lastfm-key = lib.mkIf (s.lastfm.key != null && s.lastfm.secret != null) s.lastfm.key;
lastfm-secret = lib.mkIf (s.lastfm.key != null && s.lastfm.secret != null) s.lastfm.secret; lastfm-secret = lib.mkIf (s.lastfm.key != null && s.lastfm.secret != null) s.lastfm.secret;
};
}; };
}; };
} }

View file

@ -1,6 +1,6 @@
{ pkgs, ... }: { pkgs, lib, ty-home-manager-options, ... }:
{ {
programs.konsole = { programs.konsole = lib.mkIf ty-home-manager-options.plasma.enable {
enable = true; enable = true;
defaultProfile = "Primary"; defaultProfile = "Primary";
profiles = { profiles = {

View file

@ -1,6 +1,6 @@
{ pkgs, ... }: { pkgs, lib, ty-home-manager-options, ... }:
{ {
programs.thunderbird = { programs.thunderbird = lib.mkIf ty-home-manager-options.thunderbird.enable {
enable = true; enable = true;
package = pkgs.thunderbird-latest; package = pkgs.thunderbird-latest;
profiles = { profiles = {

View file

@ -1,100 +1,102 @@
{ pkgs, inputs, system, ... }: { pkgs, inputs, system, lib, ty-home-manager-options, ... }:
{ {
programs.vscode = let vscode-package = pkgs.vscodium; in { programs.vscode = lib.mkIf ty-home-manager-options.vscode.enable (
enable = true; let vscode-package = pkgs.vscodium; in {
package = vscode-package; enable = true;
package = vscode-package;
enableUpdateCheck = false; enableUpdateCheck = false;
enableExtensionUpdateCheck = false; enableExtensionUpdateCheck = false;
mutableExtensionsDir = false; mutableExtensionsDir = false;
extensions = with (inputs.vscode-extensions.extensions."${system}".forVSCodeVersion ( extensions = with (inputs.vscode-extensions.extensions."${system}".forVSCodeVersion (
# Get pkgs.vscodium version, and remove the 4th part (forVSCodeVersion only expects 3 parts) # Get pkgs.vscodium version, and remove the 4th part (forVSCodeVersion only expects 3 parts)
# By using forVSCodeVersion, any unsupported versions are automatically excluded and this config # By using forVSCodeVersion, any unsupported versions are automatically excluded and this config
# won't build (rather than only finding out in vscode itself) # won't build (rather than only finding out in vscode itself)
pkgs.lib.strings.concatStringsSep "." ( pkgs.lib.strings.concatStringsSep "." (
pkgs.lib.lists.take 3 ( pkgs.lib.lists.take 3 (
pkgs.lib.strings.splitString "." vscode-package.version pkgs.lib.strings.splitString "." vscode-package.version
)
) )
) )); (
)); ( (with open-vsx; [
(with open-vsx; [ # Language support
# Language support rust-lang.rust-analyzer # Rust
rust-lang.rust-analyzer # Rust llvm-vs-code-extensions.vscode-clangd # C++
llvm-vs-code-extensions.vscode-clangd # C++ vadimcn.vscode-lldb # C++ Debugging
vadimcn.vscode-lldb # C++ Debugging jnoortheen.nix-ide # Nix
jnoortheen.nix-ide # Nix tamasfe.even-better-toml # TOML
tamasfe.even-better-toml # TOML yzhang.markdown-all-in-one # Markdown
yzhang.markdown-all-in-one # Markdown denoland.vscode-deno # Deno JS/TS
denoland.vscode-deno # Deno JS/TS mathiasfrohlich.kotlin # Kotlin (no LSP)
mathiasfrohlich.kotlin # Kotlin (no LSP) matthewpi.caddyfile-support # Caddyfile
matthewpi.caddyfile-support # Caddyfile # Theming
# Theming pkief.material-icon-theme # Material icons
pkief.material-icon-theme # Material icons # Utilities
# Utilities streetsidesoftware.code-spell-checker # Spellchecking
streetsidesoftware.code-spell-checker # Spellchecking jeanp413.open-remote-ssh # Remote SSH
jeanp413.open-remote-ssh # Remote SSH mkhl.direnv # nix-direnv autoloading
mkhl.direnv # nix-direnv autoloading cschlosser.doxdocgen # C++ Doxygen generator
cschlosser.doxdocgen # C++ Doxygen generator tomoki1207.pdf # PDF Viewing
tomoki1207.pdf # PDF Viewing ])
]) ++ (with vscode-marketplace; [
++ (with vscode-marketplace; [ yy0931.save-as-root # Save as root over SSH
yy0931.save-as-root # Save as root over SSH akiramiyakoda.cppincludeguard # Auto-insert header guards for header files
akiramiyakoda.cppincludeguard # Auto-insert header guards for header files ])
]) );
);
userSettings = { userSettings = {
# Editor # Editor
"editor.fontFamily" = "'FiraCode Nerd Font Mono', 'Droid Sans Mono', 'monospace', monospace"; "editor.fontFamily" = "'FiraCode Nerd Font Mono', 'Droid Sans Mono', 'monospace', monospace";
"editor.indentSize" = "tabSize"; "editor.indentSize" = "tabSize";
"editor.tabSize" = 4; "editor.tabSize" = 4;
"files.associations" = { "files.associations" = {
"*.hujson" = "jsonc"; "*.hujson" = "jsonc";
}; };
# JJ # JJ
"files.watcherExclude" = { "files.watcherExclude" = {
"**/.git/objects/**" = true; "**/.git/objects/**" = true;
"**/.git/subtree-cache/**" = true; "**/.git/subtree-cache/**" = true;
"**/.hg/store/**" = true; "**/.hg/store/**" = true;
"**/.jj" = true; "**/.jj" = true;
}; };
"files.exclude" = { "files.exclude" = {
"**/.git" = true; "**/.git" = true;
"**/.jj" = true; "**/.jj" = true;
"**/.svn" = true; "**/.svn" = true;
"**/.hg" = true; "**/.hg" = true;
"**/CVS" = true; "**/CVS" = true;
"**/.DS_Store" = true; "**/.DS_Store" = true;
"**/Thumbs.db" = true; "**/Thumbs.db" = true;
}; };
# Nix # Nix
"nix.enableLanguageServer" = true; "nix.enableLanguageServer" = true;
"nix.serverPath" = "nixd"; "nix.serverPath" = "nixd";
"nix.serverSettings" = { "nix.serverSettings" = {
nixd = { nixd = {
formatting = { formatting = {
command = [ "nixfmt" ]; command = [ "nixfmt" ];
};
nixpkgs = {
expr = ''import (builtins.getFlake "/etc/nixos").inputs.nixpkgs { }'';
};
options = {
nixos = {
expr = ''(builtins.getFlake "/etc/nixos").nixosConfigurations.ty-nixos.options'';
}; };
home-manager = {
expr = ''(builtins.getFlake "/etc/nixos").homeConfigurations."ty".options''; nixpkgs = {
expr = ''import (builtins.getFlake "/etc/nixos").inputs.nixpkgs { }'';
};
options = {
nixos = {
expr = ''(builtins.getFlake "/etc/nixos").nixosConfigurations.ty-nixos.options'';
};
home-manager = {
expr = ''(builtins.getFlake "/etc/nixos").homeConfigurations."ty".options'';
};
}; };
}; };
}; };
"direnv.restart.automatic" = true;
# C++ Include guards
"C/C++ Include Guard.Comment Style" = "Line";
"C/C++ Include Guard.Macro Type" = "Filename";
}; };
"direnv.restart.automatic" = true; }
# C++ Include guards );
"C/C++ Include Guard.Comment Style" = "Line";
"C/C++ Include Guard.Macro Type" = "Filename";
};
};
} }