rework cfg options for programs

This commit is contained in:
Tyler Starr 2025-05-29 22:19:15 -07:00
parent 24557adfe5
commit 244b244c10
13 changed files with 65 additions and 62 deletions

View File

@ -7,5 +7,16 @@ in {
../programs/borg.nix
../programs/yt-dlp.nix
];
options.modules.base-plus.enable = lib.mkEnableOption "base-plus";
config = {
modules = {
programs = {
borg.enable = true;
beancount.enable = true;
yt-dlp.enable = true;
};
};
};
}

View File

@ -7,9 +7,6 @@ in {
./keyd.nix
./gnome.nix
./peripherals.nix
../programs/chrome.nix
../programs/firefox.nix
../programs/kitty.nix
];
options.modules.desktop.enable = lib.mkEnableOption "desktop";
@ -46,5 +43,13 @@ in {
"application/x-extension-xht" = [ "google-chrome.desktop" ];
"application/pdf" = [ "google-chrome.desktop" ]; };
};
modules = {
programs = {
chrome.enable = true;
firefox.enable = true;
kitty.enable = true;
};
};
};
}

View File

@ -3,6 +3,7 @@
let cfg = config.modules.programs.appgate-sdp;
in {
options.modules.programs.appgate-sdp.enable = lib.mkEnableOption "appgate-sdp";
config = lib.mkIf cfg.enable {
environment.systemPackages = with pkgs; [
appgate-sdp

View File

@ -1,7 +1,9 @@
{ config, lib, pkgs, user, ... }:
let cfg = config.modules.base-plus;
let cfg = config.modules.programs.beancount;
in {
options.modules.programs.beancount.enable = lib.mkEnableOption "beancount";
config = lib.mkIf cfg.enable {
environment.systemPackages = with pkgs; [
fava # Web interface for the double-entry bookkeeping software Beancount

View File

@ -1,7 +1,9 @@
{ config, pkgs, user, lib, ... }:
let cfg = config.modules.base-plus;
let cfg = config.modules.programs.borg;
in {
options.modules.programs.borg.enable = lib.mkEnableOption "borg";
config = lib.mkIf cfg.enable {
environment.systemPackages = with pkgs; [
borgbackup # Deduplicating backup program

View File

@ -1,26 +1,15 @@
{ config, lib, pkgs, user, home-manager, ... }:
{
environment.systemPackages = with pkgs; [
chezmoi # Manage your dotfiles across multiple machines, securely
];
let cfg = config.modules.programs.chezmoi;
in {
options.modules.programs.chezmoi = with lib; {
apply = lib.mkOption {
type = with types; bool;
default = true;
};
};
config = {
environment.systemPackages = with pkgs; [
chezmoi # Manage your dotfiles across multiple machines, securely
];
home-manager.users.${user} = lib.mkIf cfg.apply {
home.activation.chezmoi = home-manager.lib.hm.dag.entryAfter [ "installPackages" ] ''
_saved_path=$PATH
PATH="${pkgs.git}/bin:$PATH"
run ${pkgs.chezmoi}/bin/chezmoi apply --force
PATH=$_saved_path
'';
};
home-manager.users.${user} = {
home.activation.chezmoi = home-manager.lib.hm.dag.entryAfter [ "installPackages" ] ''
_saved_path=$PATH
PATH="${pkgs.git}/bin:$PATH"
run ${pkgs.chezmoi}/bin/chezmoi apply --force
PATH=$_saved_path
'';
};
}

View File

@ -2,12 +2,7 @@
let cfg = config.modules.programs.chrome;
in {
options.modules.programs.chrome = with lib; {
enable = lib.mkOption {
type = types.bool;
default = true;
};
};
options.modules.programs.chrome.enable = lib.mkEnableOption "chrome";
config = lib.mkIf cfg.enable {
environment.systemPackages = with pkgs; [

View File

@ -2,6 +2,15 @@
{
imports = [
./appgate-sdp.nix
./beancount.nix
./borg.nix
./chezmoi.nix
./chrome.nix
./firefox.nix
./git.nix
./kitty.nix
./nvim.nix
./virt-manager.nix
./yt-dlp.nix
];
}

View File

@ -2,12 +2,7 @@
let cfg = config.modules.programs.firefox;
in {
options.modules.programs.firefox = with lib; {
enable = lib.mkOption {
type = types.bool;
default = true;
};
};
options.modules.programs.firefox.enable = lib.mkEnableOption "firefox";
config = lib.mkIf cfg.enable {
environment.systemPackages = with pkgs; [

View File

@ -1,25 +1,14 @@
{ config, lib, pkgs, user, ... }:
{
environment.systemPackages = with pkgs; [
git # Version control system for tracking changes in source code during software development
git-annex # Manages files with git, without checking the file contents into git
lazygit # Terminal-based GUI for git, making it easier to use and visualize git repositories
];
let cfg = config.modules.programs.git;
in {
options.modules.programs.git = with lib; {
keys = lib.mkOption {
type = with types; bool;
default = true;
};
};
config = {
environment.systemPackages = with pkgs; [
git # Version control system for tracking changes in source code during software development
git-annex # Manages files with git, without checking the file contents into git
lazygit # Terminal-based GUI for git, making it easier to use and visualize git repositories
];
age.secrets."git/github_personal" = lib.mkIf cfg.keys {
file = ../../secrets/git/github_personal.age;
owner = "${user}";
group = "users";
};
age.secrets."git/github_personal" = {
file = ../../secrets/git/github_personal.age;
owner = "${user}";
group = "users";
};
}

View File

@ -1,7 +1,9 @@
{ config, lib, pkgs, user, inputs, home-manager, ... }:
let cfg = config.modules.desktop;
let cfg = config.modules.programs.kitty;
in {
options.modules.programs.kitty.enable = lib.mkEnableOption "kitty";
config = lib.mkIf cfg.enable {
home-manager.users.${user} = {
home.packages = with pkgs; [

View File

@ -3,6 +3,7 @@
let cfg = config.modules.programs.virt-manager;
in {
options.modules.programs.virt-manager.enable = lib.mkEnableOption "virt-manager";
config = lib.mkIf cfg.enable {
environment.systemPackages = with pkgs; [
virt-manager # Desktop application for managing virtual machines through libvirt

View File

@ -1,7 +1,9 @@
{ config, lib, pkgs, user, ... }:
let cfg = config.modules.base-plus;
let cfg = config.modules.programs.yt-dlp;
in {
options.modules.programs.yt-dlp.enable = lib.mkEnableOption "yt-dlp";
config = lib.mkIf cfg.enable {
environment.systemPackages = with pkgs; [
yt-dlp # Command-line tool to download videos