feat: massive refactor

This commit is contained in:
2025-12-20 12:57:47 +08:00
parent f4c1b313ce
commit 454ad5885d
97 changed files with 1023 additions and 960 deletions

View File

@@ -1,12 +1,13 @@
{ config, lib, ... }:
lib.my.makeSwitch {
inherit config;
optionName = "all command line tools";
optionPath = [
"cli"
"all"
];
config' = {
let
cfg = config.my.cli.all;
in
{
options.my.cli.all = {
enable = lib.mkEnableOption "all command line tools";
};
config = lib.mkIf cfg.enable {
my.cli = {
media.all.enable = true;
misc.enable = true;

View File

@@ -1,13 +1,13 @@
{ config, lib, ... }:
lib.my.makeSwitch {
inherit config;
optionName = "all command line media tools";
optionPath = [
"cli"
"media"
"all"
];
config' = {
let
cfg = config.my.cli.media.all;
in
{
options.my.cli.media.all = {
enable = lib.mkEnableOption "all command line media tools";
};
config = lib.mkIf cfg.enable {
my.cli.media = {
go-musicfox.enable = true;
ffmpeg.enable = true;

View File

@@ -4,13 +4,15 @@
pkgs,
...
}:
lib.my.makeHomePackageConfig {
inherit config pkgs;
packageName = "ffmpeg";
packagePath = [ "ffmpeg" ];
optionPath = [
"cli"
"media"
"ffmpeg"
];
let
cfg = config.my.cli.media.ffmpeg;
in
{
options.my.cli.media.ffmpeg = {
enable = lib.mkEnableOption "ffmpeg";
};
config = lib.mkIf cfg.enable {
my.hm.home.packages = [ pkgs.ffmpeg ];
};
}

View File

@@ -5,15 +5,15 @@
secrets,
...
}:
lib.my.makeSwitch {
inherit config;
optionName = "go-musicfox";
optionPath = [
"cli"
"media"
"go-musicfox"
];
config' = {
let
cfg = config.my.cli.media.go-musicfox;
in
{
options.my.cli.media.go-musicfox = {
enable = lib.mkEnableOption "go-musicfox";
};
config = lib.mkIf cfg.enable {
my = {
hm = {
home.packages = with pkgs; [

View File

@@ -4,15 +4,19 @@
pkgs,
...
}:
lib.my.makeSwitch {
inherit config;
default = true;
optionName = "misc command line tools";
optionPath = [
"cli"
"misc"
];
config' = {
let
cfg = config.my.cli.misc;
in
{
options.my.cli.misc = {
enable = lib.mkOption {
type = lib.types.bool;
default = true;
description = "Enable misc command line tools";
};
};
config = lib.mkIf cfg.enable {
environment.systemPackages = with pkgs; [
vim
wget

View File

@@ -1,13 +1,13 @@
{ config, lib, ... }:
lib.my.makeSwitch {
inherit config;
optionName = "all command line monitor tools";
optionPath = [
"cli"
"monitor"
"all"
];
config' = {
let
cfg = config.my.cli.monitor.all;
in
{
options.my.cli.monitor.all = {
enable = lib.mkEnableOption "all command line monitor tools";
};
config = lib.mkIf cfg.enable {
my.cli.monitor = {
btop.enable = true;
};

View File

@@ -4,16 +4,16 @@
pkgs,
...
}:
lib.my.makeHomePackageConfig {
inherit config pkgs;
packageName = "btop";
packagePath = [ "btop" ];
optionPath = [
"cli"
"monitor"
"btop"
];
extraConfig = {
let
cfg = config.my.cli.monitor.btop;
in
{
options.my.cli.monitor.btop = {
enable = lib.mkEnableOption "btop";
};
config = lib.mkIf cfg.enable {
my.hm.home.packages = [ pkgs.btop ];
my.hm.xdg.configFile."btop" = {
source = ./config;
recursive = true;

View File

@@ -1,13 +1,13 @@
{ config, lib, ... }:
lib.my.makeSwitch {
inherit config;
optionName = "all shells";
optionPath = [
"cli"
"shell"
"all"
];
config' = {
let
cfg = config.my.cli.shell.all;
in
{
options.my.cli.shell.all = {
enable = lib.mkEnableOption "all shells";
};
config = lib.mkIf cfg.enable {
my.cli.shell = {
zsh.enable = true;
fish.enable = true;

View File

@@ -4,16 +4,19 @@
pkgs,
...
}:
lib.my.makeSwitch {
inherit config;
default = true;
optionName = "default fish settings";
optionPath = [
"cli"
"shell"
"fish"
];
config' = {
let
cfg = config.my.cli.shell.fish;
in
{
options.my.cli.shell.fish = {
enable = lib.mkOption {
type = lib.types.bool;
default = true;
description = "Enable default fish settings";
};
};
config = lib.mkIf cfg.enable {
my.persist.homeDirs = [
".local/share/fish"
];

View File

@@ -1,13 +1,13 @@
{ config, lib, ... }:
lib.my.makeSwitch {
inherit config;
optionName = "starship prompt";
optionPath = [
"cli"
"shell"
"starship"
];
config' = {
let
cfg = config.my.cli.shell.starship;
in
{
options.my.cli.shell.starship = {
enable = lib.mkEnableOption "starship prompt";
};
config = lib.mkIf cfg.enable {
my.hm = {
programs.starship = {
enable = true;

View File

@@ -4,16 +4,19 @@
pkgs,
...
}:
lib.my.makeSwitch {
inherit config;
default = true;
optionName = "default zsh settings";
optionPath = [
"cli"
"shell"
"zsh"
];
config' = {
let
cfg = config.my.cli.shell.zsh;
in
{
options.my.cli.shell.zsh = {
enable = lib.mkOption {
type = lib.types.bool;
default = true;
description = "Enable default zsh settings";
};
};
config = lib.mkIf cfg.enable {
my.hm = {
home.packages = with pkgs; [
fzf

View File

@@ -1,13 +1,13 @@
{ config, lib, ... }:
lib.my.makeSwitch {
inherit config;
optionName = "all command line tools";
optionPath = [
"cli"
"vcs"
"all"
];
config' = {
let
cfg = config.my.cli.vcs.all;
in
{
options.my.cli.vcs.all = {
enable = lib.mkEnableOption "all command line tools";
};
config = lib.mkIf cfg.enable {
my.cli.vcs = {
git.enable = true;
jj.enable = true;

View File

@@ -7,15 +7,16 @@
useremail,
...
}:
lib.my.makeHomeProgramConfig {
inherit config;
programName = "git";
optionPath = [
"cli"
"vcs"
"git"
];
extraConfig = {
let
cfg = config.my.cli.vcs.git;
in
{
options.my.cli.vcs.git = {
enable = lib.mkEnableOption "git";
};
config = lib.mkIf cfg.enable {
my.hm.programs.git.enable = true;
my.hm = {
programs.git = {
settings = {

View File

@@ -7,15 +7,16 @@
useremail,
...
}:
lib.my.makeHomeProgramConfig {
inherit config;
programName = "jujutsu";
optionPath = [
"cli"
"vcs"
"jj"
];
extraConfig = {
let
cfg = config.my.cli.vcs.jj;
in
{
options.my.cli.vcs.jj = {
enable = lib.mkEnableOption "jujutsu";
};
config = lib.mkIf cfg.enable {
my.hm.programs.jujutsu.enable = true;
my.hm = {
programs.jujutsu = {
settings = {