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

@@ -5,12 +5,15 @@
username,
...
}:
lib.my.makeSwitch {
inherit config;
default = true;
optionName = "default audio settings";
optionPath = [ "audio" ];
config' = {
let
cfg = config.my.audio;
in
{
options.my.audio = {
enable = lib.mkEnableOption "default audio settings";
};
config = lib.mkIf cfg.enable {
security.rtkit.enable = true;
services.pipewire = {
enable = true;

View File

@@ -1,10 +1,13 @@
{ config, lib, ... }:
lib.my.makeSwitch {
inherit config;
default = true;
optionName = "default bluetooth settings";
optionPath = [ "bluetooth" ];
config' = {
let
cfg = config.my.bluetooth;
in
{
options.my.bluetooth = {
enable = lib.mkEnableOption "default bluetooth settings";
};
config = lib.mkIf cfg.enable {
hardware.bluetooth = {
enable = true;
powerOnBoot = true;

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 = {

View File

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

View File

@@ -1,13 +1,13 @@
{ config, lib, ... }:
lib.my.makeSwitch {
inherit config;
optionName = "all coding editors";
optionPath = [
"coding"
"editor"
"all"
];
config' = {
let
cfg = config.my.coding.editor.all;
in
{
options.my.coding.editor.all = {
enable = lib.mkEnableOption "all coding editors";
};
config = lib.mkIf cfg.enable {
my.coding.editor = {
neovim.enable = true;
vscode.enable = true;

View File

@@ -4,15 +4,15 @@
pkgs,
...
}:
lib.my.makeHomeProgramConfig {
inherit config;
programName = "neovim";
optionPath = [
"coding"
"editor"
"neovim"
];
extraConfig = {
let
cfg = config.my.coding.editor.neovim;
in
{
options.my.coding.editor.neovim = {
enable = lib.mkEnableOption "neovim";
};
config = lib.mkIf cfg.enable {
my.hm = {
xdg.configFile."nvim/init.lua".source = ./nvim/init.lua;
xdg.configFile."nvim/lua" = {

View File

@@ -4,15 +4,16 @@
pkgs,
...
}:
lib.my.makeHomeProgramConfig {
inherit config;
programName = "vscode";
optionPath = [
"coding"
"editor"
"vscode"
];
extraConfig = {
let
cfg = config.my.coding.editor.vscode;
in
{
options.my.coding.editor.vscode = {
enable = lib.mkEnableOption "vscode";
};
config = lib.mkIf cfg.enable {
my.hm.programs.vscode.enable = true;
my.hm = {
programs.vscode = {
package = pkgs.vscodium;

View File

@@ -3,15 +3,16 @@
lib,
...
}:
lib.my.makeHomeProgramConfig {
inherit config;
programName = "zed-editor";
optionPath = [
"coding"
"editor"
"zed"
];
extraConfig = {
let
cfg = config.my.coding.editor.zed;
in
{
options.my.coding.editor.zed = {
enable = lib.mkEnableOption "zed-editor";
};
config = lib.mkIf cfg.enable {
my.hm.programs.zed-editor.enable = true;
my.persist.homeDirs = [
".config/zed"
".local/share/zed"

View File

@@ -1,13 +1,13 @@
{ config, lib, ... }:
lib.my.makeSwitch {
inherit config;
optionName = "all coding langs";
optionPath = [
"coding"
"langs"
"all"
];
config' = {
let
cfg = config.my.coding.langs.all;
in
{
options.my.coding.langs.all = {
enable = lib.mkEnableOption "all coding langs";
};
config = lib.mkIf cfg.enable {
my.coding.langs = {
c.enable = true;
go.enable = true;

View File

@@ -4,15 +4,15 @@
pkgs,
...
}:
lib.my.makeSwitch {
inherit config;
optionName = "c";
optionPath = [
"coding"
"langs"
"c"
];
config' = {
let
cfg = config.my.coding.langs.c;
in
{
options.my.coding.langs.c = {
enable = lib.mkEnableOption "c";
};
config = lib.mkIf cfg.enable {
my.hm.home.packages = with pkgs; [
gcc
(lib.hiPrio clang)

View File

@@ -4,17 +4,17 @@
pkgs,
...
}:
lib.my.makeHomePackageConfig {
inherit config pkgs;
packageName = "go";
packagePath = [ "go" ];
optionPath = [
"coding"
"langs"
"go"
];
extraConfig = {
let
cfg = config.my.coding.langs.go;
in
{
options.my.coding.langs.go = {
enable = lib.mkEnableOption "go";
};
config = lib.mkIf cfg.enable {
my.hm.home.packages = with pkgs; [
go
gotools
gopls
];

View File

@@ -4,15 +4,15 @@
pkgs,
...
}:
lib.my.makeSwitch {
inherit config;
optionName = "java";
optionPath = [
"coding"
"langs"
"java"
];
config' = {
let
cfg = config.my.coding.langs.java;
in
{
options.my.coding.langs.java = {
enable = lib.mkEnableOption "java";
};
config = lib.mkIf cfg.enable {
my.hm.home.packages = with pkgs; [
openjdk25
java-language-server

View File

@@ -4,15 +4,15 @@
pkgs,
...
}:
lib.my.makeSwitch {
inherit config;
optionName = "js";
optionPath = [
"coding"
"langs"
"js"
];
config' = {
let
cfg = config.my.coding.langs.js;
in
{
options.my.coding.langs.js = {
enable = lib.mkEnableOption "js";
};
config = lib.mkIf cfg.enable {
my.hm = {
home.packages = with pkgs; [
nodejs

View File

@@ -4,15 +4,15 @@
pkgs,
...
}:
lib.my.makeSwitch {
inherit config;
optionName = "lua";
optionPath = [
"coding"
"langs"
"lua"
];
config' = {
let
cfg = config.my.coding.langs.lua;
in
{
options.my.coding.langs.lua = {
enable = lib.mkEnableOption "lua";
};
config = lib.mkIf cfg.enable {
my.hm.home.packages = with pkgs; [
luajit
stylua

View File

@@ -4,17 +4,17 @@
pkgs,
...
}:
lib.my.makeHomePackageConfig {
inherit config pkgs;
packageName = "python3";
packagePath = [ "python3" ];
optionPath = [
"coding"
"langs"
"python"
];
extraConfig = {
let
cfg = config.my.coding.langs.python;
in
{
options.my.coding.langs.python = {
enable = lib.mkEnableOption "python3";
};
config = lib.mkIf cfg.enable {
my.hm.home.packages = with pkgs; [
python3
uv
pyright
];

View File

@@ -4,15 +4,15 @@
pkgs,
...
}:
lib.my.makeSwitch {
inherit config;
optionName = "QML";
optionPath = [
"coding"
"langs"
"qml"
];
config' = {
let
cfg = config.my.coding.langs.qml;
in
{
options.my.coding.langs.qml = {
enable = lib.mkEnableOption "QML";
};
config = lib.mkIf cfg.enable {
my.hm.home.packages = with pkgs; [
kdePackages.qtdeclarative
];

View File

@@ -4,15 +4,15 @@
pkgs,
...
}:
lib.my.makeSwitch {
inherit config;
optionName = "rust";
optionPath = [
"coding"
"langs"
"rust"
];
config' = {
let
cfg = config.my.coding.langs.rust;
in
{
options.my.coding.langs.rust = {
enable = lib.mkEnableOption "rust";
};
config = lib.mkIf cfg.enable {
my.hm = {
home.packages = with pkgs; [
(fenix.stable.withComponents [

View File

@@ -4,15 +4,15 @@
pkgs,
...
}:
lib.my.makeSwitch {
inherit config;
optionName = "Typst";
optionPath = [
"coding"
"langs"
"typst"
];
config' = {
let
cfg = config.my.coding.langs.typst;
in
{
options.my.coding.langs.typst = {
enable = lib.mkEnableOption "Typst";
};
config = lib.mkIf cfg.enable {
my.hm.home.packages = with pkgs; [
typst
tinymist

View File

@@ -4,14 +4,15 @@
pkgs,
...
}:
lib.my.makeSwitch {
inherit config;
optionName = "misc";
optionPath = [
"coding"
"misc"
];
config' = {
let
cfg = config.my.coding.misc;
in
{
options.my.coding.misc = {
enable = lib.mkEnableOption "misc";
};
config = lib.mkIf cfg.enable {
my.hm = {
home.packages = with pkgs; [
gnumake

View File

@@ -8,12 +8,15 @@
username,
...
}:
lib.my.makeSwitch {
inherit config;
default = true;
optionName = "default nix settings";
optionPath = [ "nix" ];
config' = {
let
cfg = config.my.nix;
in
{
options.my.nix = {
enable = lib.mkEnableOption "default nix settings";
};
config = lib.mkIf cfg.enable {
# This will add each flake input as a registry
# To make nix3 commands consistent with your flake
nix.registry = (lib.mapAttrs (_: flake: { inherit flake; })) (
@@ -58,14 +61,24 @@ lib.my.makeSwitch {
group = "users";
mode = "0400";
};
my.hm.nix.extraOptions = ''
!include ${config.sops.secrets.nix-github-token.path}
'';
my.hm.home.packages = with pkgs; [
nixd
nixfmt
];
my.hm = {
nix.extraOptions = ''
!include ${config.sops.secrets.nix-github-token.path}
'';
home.packages = with pkgs; [
nixd
nixfmt
];
xdg.configFile."direnv/lib/angrr.sh".source =
"${config.services.angrr.package}/share/direnv/lib/angrr.sh";
programs.direnv.stdlib = ''
use angrr
'';
};
# uncomment to enable auto gc
/*
@@ -82,10 +95,5 @@ lib.my.makeSwitch {
period = "1month";
};
};
my.hm.xdg.configFile."direnv/lib/angrr.sh".source =
"${config.services.angrr.package}/share/direnv/lib/angrr.sh";
my.hm.programs.direnv.stdlib = ''
use angrr
'';
};
}

View File

@@ -12,6 +12,7 @@ in
enable = lib.mkEnableOption "persist";
location = lib.mkOption {
type = lib.types.str;
default = "/nix/persist";
example = lib.literalExpression ''
"/persistent"
'';

View File

@@ -1,10 +1,15 @@
{ config, lib, ... }:
lib.my.makeSwitch {
inherit config;
default = true;
optionName = "default time settings";
optionPath = [ "time" ];
config' = {
let
cfg = config.my.time;
in
{
options.my.time = {
enable = lib.mkEnableOption "default time settings" // {
default = true;
};
};
config = lib.mkIf cfg.enable {
time.timeZone = "Asia/Shanghai";
networking.timeServers = [
"0.cn.pool.ntp.org"

View File

@@ -7,12 +7,17 @@
secrets,
...
}:
lib.my.makeSwitch {
inherit config;
default = true;
optionName = "default user settings";
optionPath = [ "user" ];
config' = {
let
cfg = config.my.user;
in
{
options.my.user = {
enable = lib.mkEnableOption "default user settings" // {
default = true;
};
};
config = lib.mkIf cfg.enable {
programs.zsh.enable = true;
sops.secrets.imxyy-nix-hashed-password = {

View File

@@ -2,6 +2,7 @@
lib,
config,
pkgs,
username,
...
}:
let

View File

@@ -1,12 +1,13 @@
{ config, lib, ... }:
lib.my.makeSwitch {
inherit config;
optionName = "all desktop things";
optionPath = [
"desktop"
"all"
];
config' = {
let
cfg = config.my.desktop.all;
in
{
options.my.desktop.all = {
enable = lib.mkEnableOption "all desktop things";
};
config = lib.mkIf cfg.enable {
my.desktop = {
browser.all.enable = true;
gaming.all.enable = true;

View File

@@ -1,13 +1,13 @@
{ config, lib, ... }:
lib.my.makeSwitch {
inherit config;
optionName = "all desktop browsers";
optionPath = [
"desktop"
"browser"
"all"
];
config' = {
let
cfg = config.my.desktop.browser.all;
in
{
options.my.desktop.browser.all = {
enable = lib.mkEnableOption "all desktop browsers";
};
config = lib.mkIf cfg.enable {
my.desktop.browser = {
firefox.enable = true;
chromium.enable = true;

View File

@@ -4,15 +4,16 @@
pkgs,
...
}:
lib.my.makeHomeProgramConfig {
inherit config;
programName = "chromium";
optionPath = [
"desktop"
"browser"
"chromium"
];
extraConfig = {
let
cfg = config.my.desktop.browser.chromium;
in
{
options.my.desktop.browser.chromium = {
enable = lib.mkEnableOption "chromium";
};
config = lib.mkIf cfg.enable {
my.hm.programs.chromium.enable = true;
my.hm.programs.chromium = {
package = pkgs.ungoogled-chromium;
extensions = [

View File

@@ -1,13 +1,14 @@
{ config, lib, ... }:
lib.my.makeHomeProgramConfig {
inherit config;
programName = "firefox";
optionPath = [
"desktop"
"browser"
"firefox"
];
extraConfig = {
let
cfg = config.my.desktop.browser.firefox;
in
{
options.my.desktop.browser.firefox = {
enable = lib.mkEnableOption "firefox";
};
config = lib.mkIf cfg.enable {
my.hm.programs.firefox.enable = true;
my.persist.homeDirs = [
".mozilla"
];

View File

@@ -4,15 +4,15 @@
pkgs,
...
}:
lib.my.makeHomeProgramConfig {
inherit config;
programName = "zen-browser";
optionPath = [
"desktop"
"browser"
"zen"
];
extraConfig = {
let
cfg = config.my.desktop.browser.zen;
in
{
options.my.desktop.browser.zen = {
enable = lib.mkEnableOption "zen-browser";
};
config = lib.mkIf cfg.enable {
my.hm.programs.zen-browser = {
enable = true;
nativeMessagingHosts = [ pkgs.firefoxpwa ];

View File

@@ -1,13 +1,13 @@
{ config, lib, ... }:
lib.my.makeSwitch {
inherit config;
optionName = "all desktop gaming things";
optionPath = [
"desktop"
"gaming"
"all"
];
config' = {
let
cfg = config.my.desktop.gaming.all;
in
{
options.my.desktop.gaming.all = {
enable = lib.mkEnableOption "all desktop gaming things";
};
config = lib.mkIf cfg.enable {
my.desktop.gaming = {
minecraft.enable = true;
steam.enable = true;

View File

@@ -4,15 +4,15 @@
pkgs,
...
}:
lib.my.makeSwitch {
inherit config;
optionName = "minecraft";
optionPath = [
"desktop"
"gaming"
"minecraft"
];
config' = {
let
cfg = config.my.desktop.gaming.minecraft;
in
{
options.my.desktop.gaming.minecraft = {
enable = lib.mkEnableOption "minecraft";
};
config = lib.mkIf cfg.enable {
my.hm.home.packages = [
(pkgs.hmcl.overrideAttrs {
postFixup = ''

View File

@@ -4,15 +4,15 @@
pkgs,
...
}:
lib.my.makeSwitch {
inherit config;
optionName = "steam";
optionPath = [
"desktop"
"gaming"
"steam"
];
config' = {
let
cfg = config.my.desktop.gaming.steam;
in
{
options.my.desktop.gaming.steam = {
enable = lib.mkEnableOption "steam";
};
config = lib.mkIf cfg.enable {
programs.steam = {
enable = true;
package = pkgs.steam;

View File

@@ -1,13 +1,13 @@
{ config, lib, ... }:
lib.my.makeSwitch {
inherit config;
optionName = "all desktop media things";
optionPath = [
"desktop"
"media"
"all"
];
config' = {
let
cfg = config.my.desktop.media.all;
in
{
options.my.desktop.media.all = {
enable = lib.mkEnableOption "all desktop media things";
};
config = lib.mkIf cfg.enable {
my.desktop.media = {
mpv.enable = true;
shotwell.enable = true;

View File

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

View File

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

View File

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

View File

@@ -4,16 +4,16 @@
pkgs,
...
}:
lib.my.makeHomePackageConfig {
inherit config pkgs;
packageName = "spotube";
packagePath = [ "spotube" ];
optionPath = [
"desktop"
"media"
"spotube"
];
extraConfig = {
let
cfg = config.my.desktop.media.spotube;
in
{
options.my.desktop.media.spotube = {
enable = lib.mkEnableOption "spotube";
};
config = lib.mkIf cfg.enable {
my.hm.home.packages = [ pkgs.spotube ];
my.persist.homeDirs = [
".local/share/oss.krtirtho.spotube"
];

View File

@@ -4,16 +4,16 @@
pkgs,
...
}:
lib.my.makeHomePackageConfig {
inherit config pkgs;
packageName = "thunderbird";
packagePath = [ "thunderbird" ];
optionPath = [
"desktop"
"media"
"thunderbird"
];
extraConfig = {
let
cfg = config.my.desktop.media.thunderbird;
in
{
options.my.desktop.media.thunderbird = {
enable = lib.mkEnableOption "thunderbird";
};
config = lib.mkIf cfg.enable {
my.hm.home.packages = [ pkgs.thunderbird ];
my.persist.homeDirs = [
".thunderbird"
];

View File

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

View File

@@ -1,13 +1,13 @@
{ config, lib, ... }:
lib.my.makeSwitch {
inherit config;
optionName = "all screencast tools";
optionPath = [
"desktop"
"screencast"
"all"
];
config' = {
let
cfg = config.my.desktop.screencast.all;
in
{
options.my.desktop.screencast.all = {
enable = lib.mkEnableOption "all screencast tools";
};
config = lib.mkIf cfg.enable {
my.desktop.screencast = {
obs-studio.enable = true;
};

View File

@@ -4,15 +4,15 @@
pkgs,
...
}:
lib.my.makeSwitch {
inherit config;
optionName = "obs-studio";
optionPath = [
"desktop"
"screencast"
"obs-studio"
];
config' = {
let
cfg = config.my.desktop.screencast.obs-studio;
in
{
options.my.desktop.screencast.obs-studio = {
enable = lib.mkEnableOption "obs-studio";
};
config = lib.mkIf cfg.enable {
my.hm.home.packages = with pkgs; [
(pkgs.wrapOBS {
plugins = with pkgs.obs-studio-plugins; [

View File

@@ -4,14 +4,15 @@
pkgs,
...
}:
lib.my.makeSwitch {
inherit config;
optionName = "style";
optionPath = [
"desktop"
"style"
];
config' = {
let
cfg = config.my.desktop.style;
in
{
options.my.desktop.style = {
enable = lib.mkEnableOption "style";
};
config = lib.mkIf cfg.enable {
catppuccin.sddm = {
enable = true;
font = "Jetbrains Mono";

View File

@@ -1,13 +1,14 @@
{ config, lib, ... }:
lib.my.makeHomeProgramConfig {
inherit config;
programName = "alacritty";
optionPath = [
"desktop"
"terminal"
"alacritty"
];
extraConfig = {
let
cfg = config.my.desktop.terminal.alacritty;
in
{
options.my.desktop.terminal.alacritty = {
enable = lib.mkEnableOption "alacritty";
};
config = lib.mkIf cfg.enable {
my.hm.programs.alacritty.enable = true;
my.hm.programs.alacritty.settings = {
general.import = [ ./tokyonight-storm.toml ];
cursor.style = {

View File

@@ -1,13 +1,13 @@
{ config, lib, ... }:
lib.my.makeSwitch {
inherit config;
optionName = "all terminals";
optionPath = [
"desktop"
"terminal"
"all"
];
config' = {
let
cfg = config.my.desktop.terminal.all;
in
{
options.my.desktop.terminal.all = {
enable = lib.mkEnableOption "all terminals";
};
config = lib.mkIf cfg.enable {
my.desktop.terminal = {
alacritty.enable = true;
foot.enable = true;

View File

@@ -1,13 +1,14 @@
{ config, lib, ... }:
lib.my.makeHomeProgramConfig {
inherit config;
programName = "foot";
optionPath = [
"desktop"
"terminal"
"foot"
];
extraConfig = {
let
cfg = config.my.desktop.terminal.foot;
in
{
options.my.desktop.terminal.foot = {
enable = lib.mkEnableOption "foot";
};
config = lib.mkIf cfg.enable {
my.hm.programs.foot.enable = true;
my.hm.programs.foot = {
server.enable = true;
settings = {

View File

@@ -1,13 +1,14 @@
{ config, lib, ... }:
lib.my.makeHomeProgramConfig {
inherit config;
programName = "ghostty";
optionPath = [
"desktop"
"terminal"
"ghostty"
];
extraConfig = {
let
cfg = config.my.desktop.terminal.ghostty;
in
{
options.my.desktop.terminal.ghostty = {
enable = lib.mkEnableOption "ghostty";
};
config = lib.mkIf cfg.enable {
my.hm.programs.ghostty.enable = true;
my.hm.programs.ghostty = {
enableBashIntegration = true;
enableZshIntegration = true;

View File

@@ -1,13 +1,14 @@
{ config, lib, ... }:
lib.my.makeHomeProgramConfig {
inherit config;
programName = "kitty";
optionPath = [
"desktop"
"terminal"
"kitty"
];
extraConfig = {
let
cfg = config.my.desktop.terminal.kitty;
in
{
options.my.desktop.terminal.kitty = {
enable = lib.mkEnableOption "kitty";
};
config = lib.mkIf cfg.enable {
my.hm.programs.kitty.enable = true;
my.hm.programs.kitty = {
settings = {
cursor_blink_interval = 0;

View File

@@ -4,14 +4,15 @@
pkgs,
...
}:
lib.my.makeSwitch {
inherit config;
optionName = "wine";
optionPath = [
"desktop"
"wine"
];
config' = {
let
cfg = config.my.desktop.wine;
in
{
options.my.desktop.wine = {
enable = lib.mkEnableOption "wine";
};
config = lib.mkIf cfg.enable {
my.hm.home.packages = with pkgs; [
wine-wayland
bottles

View File

@@ -3,15 +3,15 @@
lib,
...
}:
lib.my.makeSwitch {
inherit config;
optionName = "all window managers";
optionPath = [
"desktop"
"wm"
"all"
];
config' = {
let
cfg = config.my.desktop.wm.all;
in
{
options.my.desktop.wm.all = {
enable = lib.mkEnableOption "all window managers";
};
config = lib.mkIf cfg.enable {
my.desktop.wm = {
cage.enable = true;
niri.enable = true;

View File

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

View File

@@ -4,12 +4,17 @@
lib,
...
}:
lib.my.makeSwitch {
inherit config;
default = true;
optionName = "default font settings";
optionPath = [ "fonts" ];
config' = {
let
cfg = config.my.fonts;
in
{
options.my.fonts = {
enable = lib.mkEnableOption "default font settings" // {
default = true;
};
};
config = lib.mkIf cfg.enable {
fonts = {
enableDefaultPackages = false;
fontDir.enable = true;

View File

@@ -2,18 +2,26 @@
config,
lib,
pkgs,
username,
...
}:
lib.my.makeHomeProgramConfig {
inherit config;
programName = "gpg";
optionPath = [ "gpg" ];
extraConfig = {
let
cfg = config.my.gpg;
in
{
options.my.gpg = {
enable = lib.mkEnableOption "GPG and GPG agent";
};
config = lib.mkIf cfg.enable {
programs.gnupg.agent = {
enable = true;
pinentryPackage = pkgs.pinentry-curses;
enableSSHSupport = true;
};
my.hm.programs.gpg.enable = true;
my.persist.homeDirs = [
{
directory = ".gnupg";

View File

@@ -4,14 +4,15 @@
pkgs,
...
}:
lib.my.makeSwitch {
inherit config;
optionName = "default fcitx5 settings";
optionPath = [
"i18n"
"fcitx5"
];
config' = {
let
cfg = config.my.i18n.fcitx5;
in
{
options.my.i18n.fcitx5 = {
enable = lib.mkEnableOption "default fcitx5 settings";
};
config = lib.mkIf cfg.enable {
i18n.inputMethod = {
enable = true;
type = "fcitx5";
@@ -114,17 +115,11 @@ lib.my.makeSwitch {
desktop,
}:
{
${pkg} = final.stdenvNoCC.mkDerivation {
inherit (prev.${pkg}) pname version;
src = prev.${pkg};
phases = [
"unpackPhase"
"installPhase"
];
${pkg} = final.symlinkJoin {
name = prev.${pkg}.name;
paths = [ prev.${pkg} ];
nativeBuildInputs = [ final.makeWrapper ];
installPhase = ''
cp -r . $out
postBuild = ''
substituteInPlace $out/share/applications/${desktop}.desktop --replace-quiet "${prev.${pkg}}" $out
wrapProgram $out/bin/${exe} --add-flags "--wayland-text-input-version=3"
'';
@@ -157,22 +152,15 @@ lib.my.makeSwitch {
(
{ pkg, desktops }:
{
${pkg} = final.stdenvNoCC.mkDerivation {
inherit (prev.${pkg}) pname version;
src = prev.${pkg};
phases = [
"unpackPhase"
"installPhase"
];
installPhase =
"cp -r . $out \n"
+ lib.concatLines (
map (
desktop:
"substituteInPlace $out/share/applications/${desktop}.desktop --replace-fail 'Exec=' 'Exec=env QT_IM_MODULE=fcitx XMODIFIERS=@im=fcitx '"
) desktops
);
${pkg} = final.symlinkJoin {
name = prev.${pkg}.name;
paths = [ prev.${pkg} ];
postBuild = lib.concatLines (
map (
desktop:
"substituteInPlace $out/share/applications/${desktop}.desktop --replace-fail 'Exec=' 'Exec=env QT_IM_MODULE=fcitx XMODIFIERS=@im=fcitx '"
) desktops
);
};
}
)

View File

@@ -1,13 +1,15 @@
{ config, lib, ... }:
lib.my.makeSwitch {
inherit config;
default = true;
optionName = "default locale settings";
optionPath = [
"i18n"
"locale"
];
config' = {
let
cfg = config.my.i18n.locale;
in
{
options.my.i18n.locale = {
enable = lib.mkEnableOption "default locale settings" // {
default = true;
};
};
config = lib.mkIf cfg.enable {
i18n = {
defaultLocale = "en_US.UTF-8";
extraLocaleSettings = {

View File

@@ -16,7 +16,9 @@ in
};
sshKeyFile = lib.mkOption {
type = lib.types.str;
default = "${config.my.persist.location}/home/${username}/.ssh/id_ed25519";
default = "${
if config.my.persist.enable then config.my.persist.location else ""
}/home/${username}/.ssh/id_ed25519";
};
};

View File

@@ -23,25 +23,11 @@ let
} settings;
in
{
imports = [
(lib.my.makeHomePackageConfig {
inherit config pkgs;
packageName = "moonlight-qt";
packagePath = [ "moonlight-qt" ];
optionPath = [
"virt"
"moonlight"
];
extraConfig = {
my.persist.homeDirs = [
".config/Moonlight Game Streaming Project"
];
};
})
];
options.my.virt = {
enable = lib.mkEnableOption "virtualization";
moonlight = {
enable = lib.mkEnableOption "Moonlight";
};
looking-glass = {
enable = lib.mkEnableOption "looking-glass";
package = lib.mkPackageOption pkgs "looking-glass-client" { };
@@ -116,7 +102,7 @@ in
settings = lib.mkOption {
description = "Looking Glass client configuration";
default = { };
type = lib.types.submodule ./types;
type = lib.types.submodule ./_types;
example = {
app.shmFile = "/dev/kvmfr0";
@@ -232,5 +218,11 @@ in
users.users.${username}.extraGroups = [ "libvirtd" ];
environment.systemPackages = with pkgs; [ virglrenderer ];
})
(lib.mkIf cfg.moonlight.enable {
my.hm.home.packages = [ pkgs.moonlight-qt ];
my.persist.homeDirs = [
".config/Moonlight Game Streaming Project"
];
})
];
}