refactor(nixos): inline module enable conditions

This commit was merged in pull request #134.
This commit is contained in:
2026-10-06 22:26:47 -04:00
parent d53246caf0
commit f48bac5ec1
33 changed files with 33 additions and 78 deletions

View File

@@ -6,14 +6,13 @@
}:
# Bazel for the primary user's shell environment.
let
cfg = config.modules.shell.bazel; # NOLINT(let_order)
user = config.user.name;
in
{
options.modules.shell.bazel.enable =
lib.mkEnableOption "Bazel for the primary user's shell environment";
config = lib.mkIf cfg.enable {
config = lib.mkIf config.modules.shell.bazel.enable {
home-manager.users.${user}.home.packages = [ pkgs.bazel ];
};
}

View File

@@ -5,14 +5,13 @@
}:
# direnv for the primary user, configured through home-manager.
let
cfg = config.modules.shell.direnv; # NOLINT(let_order)
user = config.user.name;
in
{
options.modules.shell.direnv.enable =
lib.mkEnableOption "direnv for the primary user, with nix-direnv shell caching";
config = lib.mkIf cfg.enable {
config = lib.mkIf config.modules.shell.direnv.enable {
home-manager.users.${user}.programs.direnv = {
enable = true;
silent = true;

View File

@@ -5,14 +5,13 @@
}:
# git for the primary user, configured through home-manager.
let
cfg = config.modules.shell.git; # NOLINT(let_order)
user = config.user.name;
in
{
options.modules.shell.git.enable =
lib.mkEnableOption "git for the primary user, carrying the operator's commit identity";
config = lib.mkIf cfg.enable {
config = lib.mkIf config.modules.shell.git.enable {
home-manager.users.${user}.programs.git = {
enable = true;

View File

@@ -6,14 +6,13 @@
}:
# gitea-axi for the primary user, installed through its own home-manager module.
let
cfg = config.modules.shell.gitea-axi; # NOLINT(let_order)
user = config.user.name;
in
{
options.modules.shell.gitea-axi.enable =
lib.mkEnableOption "gitea-axi, an agent-ergonomic CLI for Gitea issues and pull requests";
config = lib.mkIf cfg.enable {
config = lib.mkIf config.modules.shell.gitea-axi.enable {
home-manager.sharedModules = [ inputs.gitea-axi.homeModules.default ];
home-manager.users.${user}.programs.gitea-axi.enable = true;
};

View File

@@ -6,14 +6,13 @@
}:
# Herdr, a terminal multiplexer for coding agents.
let
cfg = config.modules.shell.herdr; # NOLINT(let_order)
user = config.user.name;
in
{
options.modules.shell.herdr.enable =
lib.mkEnableOption "Herdr, a terminal multiplexer for coding agents";
config = lib.mkIf cfg.enable {
config = lib.mkIf config.modules.shell.herdr.enable {
registry.shell-shortcut.${config.networking.hostName}.hs = "herdr --session";
home-manager.users.${user} = lib.mkMerge [

View File

@@ -7,14 +7,13 @@
}:
# Neovim for the primary user, configured declaratively through nixvim.
let
cfg = config.modules.shell.nvim; # NOLINT(let_order)
user = config.user.name;
in
{
options.modules.shell.nvim.enable =
lib.mkEnableOption "Neovim, configured declaratively via nixvim";
config = lib.mkIf cfg.enable {
config = lib.mkIf config.modules.shell.nvim.enable {
registry.shell-shortcut.${config.networking.hostName} = {
vi = "nvim";
vim = "nvim";

View File

@@ -6,7 +6,6 @@
}:
# Oh My Pi, installed alongside upstream Pi as the `omp` command.
let
cfg = config.modules.shell.omp; # NOLINT(let_order)
user = config.user.name;
in
{
@@ -14,7 +13,7 @@ in
enable = lib.mkEnableOption "Oh My Pi, a batteries-included fork of Pi";
};
config = lib.mkIf cfg.enable {
config = lib.mkIf config.modules.shell.omp.enable {
home-manager.users.${user}.home.packages = [ pkgs.omp ];
};
}

View File

@@ -6,14 +6,13 @@
}:
# Python tools for the primary user's shell environment.
let
cfg = config.modules.shell.python; # NOLINT(let_order)
user = config.user.name;
in
{
options.modules.shell.python.enable =
lib.mkEnableOption "Python tools for the primary user's shell environment";
config = lib.mkIf cfg.enable {
config = lib.mkIf config.modules.shell.python.enable {
home-manager.users.${user}.home = {
sessionVariables.PYTHON_TOOLCHAIN_ROOT = "${pkgs.python3}";
packages = [ pkgs.python3 ];

View File

@@ -6,7 +6,6 @@
}:
# Rust tools for the primary user's shell environment.
let
cfg = config.modules.shell.rust; # NOLINT(let_order)
toolchain = pkgs.symlinkJoin {
name = "rust-toolchain";
paths = with pkgs; [
@@ -23,7 +22,7 @@ in
options.modules.shell.rust.enable =
lib.mkEnableOption "Rust tools for the primary user's shell environment";
config = lib.mkIf cfg.enable {
config = lib.mkIf config.modules.shell.rust.enable {
home-manager.users.${user} = {
home.sessionVariables.RUST_TOOLCHAIN_ROOT = "${toolchain}";

View File

@@ -6,13 +6,12 @@
# tmux for the primary user, configured through home-manager.
# Settings without a home-manager option are read from ./extra.conf.
let
cfg = config.modules.shell.tmux; # NOLINT(let_order)
user = config.user.name;
in
{
options.modules.shell.tmux.enable = lib.mkEnableOption "tmux, configured via home-manager";
config = lib.mkIf cfg.enable {
config = lib.mkIf config.modules.shell.tmux.enable {
registry.shell-shortcut.${config.networking.hostName}.tmx = "tmux new-session -A -s";
home-manager.users.${user}.programs.tmux = {

View File

@@ -6,13 +6,12 @@
}:
# Yazi, a terminal file manager.
let
cfg = config.modules.shell.yazi; # NOLINT(let_order)
user = config.user.name;
in
{
options.modules.shell.yazi.enable = lib.mkEnableOption "Yazi, a terminal file manager";
config = lib.mkIf cfg.enable {
config = lib.mkIf config.modules.shell.yazi.enable {
home-manager.users.${user}.programs.yazi = {
enable = true;
enableFishIntegration = true;