Make config more configurable

This commit is contained in:
Martin Pander
2026-02-07 14:23:51 +01:00
parent a81bae3a85
commit 84ad11d543
10 changed files with 180 additions and 129 deletions

View File

@@ -117,8 +117,7 @@ sudo nix-collect-garbage -d
- **nvim.nix**: Personalized Neovim setup. - **nvim.nix**: Personalized Neovim setup.
- **tmux.nix**: Terminal multiplexer configuration. - **tmux.nix**: Terminal multiplexer configuration.
- **git.nix**: Git, Lazygit, and Jujutsu settings. - **git.nix**: Git, Lazygit, and Jujutsu settings.
- **dev.nix**: Development tools and language runtimes. - **dev.nix**: Development tools, language runtimes, and LLM tool configurations.
- **llm.nix**: Local and API-based LLM tool configurations.
- **task.nix**: Taskwarrior and productivity tools. - **task.nix**: Taskwarrior and productivity tools.
### NixOS Modules (`modules/nixos/`) ### NixOS Modules (`modules/nixos/`)

22
nix/hosts/home/common.nix Normal file
View File

@@ -0,0 +1,22 @@
{ config, pkgs, ... }:
{
imports = [
../../modules/home/common.nix
];
programs.git.settings.user = {
name = "Martin Pander";
email = "git@pander-on.de";
};
programs.jujutsu.settings.user = {
name = "Martin Pander";
email = "git@pander-on.de";
};
dot.llm = {
enable = true;
gemini-cli.enable = true;
};
}

View File

@@ -2,21 +2,11 @@
{ {
imports = [ imports = [
../../../modules/home/common.nix ../common.nix
]; ];
home.username = "martin"; home.username = "martin";
home.homeDirectory = "/Users/martin"; home.homeDirectory = "/Users/martin";
home.stateVersion = "24.05"; home.stateVersion = "24.05";
programs.git.settings.user = {
name = "Martin Pander";
email = "git@pander-on.de";
};
programs.jujutsu.settings.user = {
name = "Martin Pander";
email = "git@pander-on.de";
};
} }

View File

@@ -2,7 +2,7 @@
{ {
imports = [ imports = [
../../../modules/home/common.nix ../common.nix
]; ];
# User details # User details

25
nix/hosts/work/common.nix Normal file
View File

@@ -0,0 +1,25 @@
{ config, pkgs, ... }:
{
imports = [
../../modules/home/common.nix
];
programs.git.settings.user = {
name = "Martin Pander";
email = "martin.pander@knowtion.de";
};
programs.jujutsu.settings.user = {
name = "Martin Pander";
email = "martin.pander@knowtion.de";
};
dot.llm = {
enable = true;
claude-code.enable = true;
opencode.enable = true;
};
dot.tmux.workMode = true;
}

View File

@@ -2,25 +2,18 @@
{ {
imports = [ imports = [
../../../modules/home/common.nix ../common.nix
../../../modules/home/llm.nix
]; ];
home.username = "pan"; home.username = "pan";
home.homeDirectory = "/home/pan"; home.homeDirectory = "/home/pan";
home.packages = with pkgs; [
nix-ld
];
home.stateVersion = "23.11"; home.stateVersion = "23.11";
programs.git.settings.user = {
name = "Martin Pander";
email = "martin.pander@knowtion.de";
};
programs.jujutsu.settings.user = {
name = "Martin Pander";
email = "martin.pander@knowtion.de";
};
programs.zsh.profileExtra = '' programs.zsh.profileExtra = ''
source $HOME/.profile source $HOME/.profile
''; '';

View File

@@ -2,30 +2,13 @@
{ {
imports = [ imports = [
../../../modules/home/common.nix ../common.nix
]; ];
# User details # User details
home.username = "pan"; home.username = "pan";
home.homeDirectory = "/home/pan"; home.homeDirectory = "/home/pan";
# Git and Jujutsu user configuration # Home Manager release version
programs.git.settings.user = {
name = "Martin Pander";
email = "martin.pander@knowtion.de";
};
programs.jujutsu.settings.user = {
name = "Martin Pander";
email = "martin.pander@knowtion.de";
};
home.packages = with pkgs; [
nix-ld
];
# This value determines the Home Manager release which the configuration is
# compatible with. This helps avoid breakage when a new Home Manager release
# introduces backwards incompatible changes.
home.stateVersion = "25.05"; home.stateVersion = "25.05";
} }

View File

@@ -1,6 +1,35 @@
{ config, pkgs, ... }: { config, pkgs, lib, ... }:
let
cfg = config.dot.llm;
in
{ {
options.dot.llm = {
enable = lib.mkEnableOption "LLM tools";
claude-code.enable = lib.mkOption {
type = lib.types.bool;
default = false;
description = "Enable claude-code";
};
opencode.enable = lib.mkOption {
type = lib.types.bool;
default = false;
description = "Enable opencode";
};
gemini-cli.enable = lib.mkOption {
type = lib.types.bool;
default = false;
description = "Enable gemini-cli";
};
bubblewrap.enable = lib.mkOption {
type = lib.types.bool;
default = pkgs.stdenv.isLinux;
description = "Enable bubblewrap (Linux only)";
};
};
config = lib.mkMerge [
{
programs.direnv = { programs.direnv = {
enable = true; enable = true;
enableZshIntegration = true; enableZshIntegration = true;
@@ -10,4 +39,14 @@
home.packages = with pkgs; [ home.packages = with pkgs; [
visidata visidata
]; ];
}
(lib.mkIf cfg.enable {
home.packages =
(lib.optional cfg.claude-code.enable pkgs.claude-code) ++
(lib.optional cfg.opencode.enable pkgs.opencode) ++
(lib.optional cfg.gemini-cli.enable pkgs.gemini-cli) ++
(lib.optional (cfg.bubblewrap.enable && pkgs.stdenv.isLinux) pkgs.bubblewrap);
})
];
} }

View File

@@ -1,10 +0,0 @@
{ config, pkgs, ... }:
{
home.packages = with pkgs; [
bubblewrap
claude-code
opencode
gemini-cli
];
}

View File

@@ -1,6 +1,14 @@
{ config, pkgs, lib, ... }: { config, pkgs, lib, ... }:
let
cfg = config.dot.tmux;
in
{ {
options.dot.tmux = {
workMode = lib.mkEnableOption "work-specific tmux configuration";
};
config = {
programs.tmux = { programs.tmux = {
enable = true; enable = true;
shortcut = "a"; shortcut = "a";
@@ -25,13 +33,14 @@
bind % split-window -h -c "#{pane_current_path}" bind % split-window -h -c "#{pane_current_path}"
bind c new-window -a -c "#{pane_current_path}" bind c new-window -a -c "#{pane_current_path}"
bind C-s display-popup -E "zsh ~/bin/tmuxp_selector.sh"
bind C-g display-popup -E -d "#{pane_current_path}" -xC -yC -w 95% -h 95% "lazygit" bind C-g display-popup -E -d "#{pane_current_path}" -xC -yC -w 95% -h 95% "lazygit"
bind C-t display-popup -E -xC -yC -w 95% -h 95% "tasksquire" bind C-t display-popup -E -xC -yC -w 95% -h 95% "tasksquire"
# Note: The following keybindings had hard-coded WSL paths that were removed.
# Adjust the paths below to match your NixOS environment: ${lib.optionalString cfg.workMode ''
# bind C-n display-popup -E -xC -yC -w 95% -h 95% -d "~/Documents/notes/Work/" "vim quick_notes.md" bind C-s display-popup -E "zsh ~/bin/tmuxp_selector.sh"
# bind C-p display-popup -E -xC -yC -w 95% -h 95% -d "~/Documents/notes/Work/development/" "vim mbpr.md" bind C-n display-popup -E -xC -yC -w 95% -h 95% -d "~/Documents/notes/Work/" "vim quick_notes.md"
bind C-p display-popup -E -xC -yC -w 95% -h 95% -d "~/Documents/notes/Work/development/" "vim mbpr.md"
''}
####################################### #######################################
# status line # status line
@@ -70,4 +79,5 @@
"o" = "tmuxp"; "o" = "tmuxp";
"ol" = "tmuxp load"; "ol" = "tmuxp load";
}; };
};
} }