Refactor gui module

This commit is contained in:
ulic-youthlic 2025-07-01 23:17:40 +08:00
parent edfe0e5bf9
commit e65183b4a4
Signed by: youthlic
GPG key ID: 63E86C3C14A0D721
36 changed files with 236 additions and 309 deletions

54
flake.lock generated
View file

@ -96,11 +96,11 @@
"rust-overlay": "rust-overlay"
},
"locked": {
"lastModified": 1751288193,
"narHash": "sha256-fVjXqI2csi3OtrtZ/Jsc8Qk+NjijP4xTCYFjuLFthYI=",
"lastModified": 1751379343,
"narHash": "sha256-D+cTBd6NiLP8twrd1QAl5OPAnwur+RVQswmu4nKzq/I=",
"owner": "chaotic-cx",
"repo": "nyx",
"rev": "55f2f21811657e628e99900b20d72bc7def3f3f2",
"rev": "5f0ef779e8f954c95f7f7ba9f5c8739c06438327",
"type": "github"
},
"original": {
@ -393,11 +393,11 @@
"rust-overlay": "rust-overlay_2"
},
"locked": {
"lastModified": 1751294722,
"narHash": "sha256-EDLXP+9OOby5NrfKKGzdg6cuuCzl+xCHHYppRg/6nHU=",
"lastModified": 1751378814,
"narHash": "sha256-pdYjEgdVYEerzxxmrM0GJAFGZ+J50NRD0rtDZ16SuTM=",
"owner": "helix-editor",
"repo": "helix",
"rev": "91dff9393dc53dc6214b7fb50882f5c55c8837d9",
"rev": "6a090471a800b1001bdfd2b6e0b710c1cd439a4e",
"type": "github"
},
"original": {
@ -435,11 +435,11 @@
]
},
"locked": {
"lastModified": 1751296747,
"narHash": "sha256-/nHOfmB0C972nYX0xVF0zWmbt8ooA9TCczfeKHNvwqI=",
"lastModified": 1751336185,
"narHash": "sha256-ptnVr2x+sl7cZcTuGx/0BOE2qCAIYHTcgfA+/h60ml0=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "0f21ed5182a158d2f84e9136f6bf8539fd9a6890",
"rev": "96354906f58464605ff81d2f6c2ea23211cbf051",
"type": "github"
},
"original": {
@ -522,11 +522,11 @@
"xwayland-satellite-unstable": "xwayland-satellite-unstable"
},
"locked": {
"lastModified": 1751275819,
"narHash": "sha256-013hN0hBpLAPS9PQhkQKb2KOUB3Y1Ef7poANHpsxbck=",
"lastModified": 1751335430,
"narHash": "sha256-OVP1yknJHvRK+eIy56UZsf9kUXSmwlwitPa9dZ0/HWo=",
"owner": "sodiboo",
"repo": "niri-flake",
"rev": "91b2083cad55e4607ebc1cf920c08daf209ad7a0",
"rev": "fab3c874b28d95696225b4e575c3b6dc5d6058fe",
"type": "github"
},
"original": {
@ -614,11 +614,11 @@
},
"nixos-hardware": {
"locked": {
"lastModified": 1750837715,
"narHash": "sha256-2m1ceZjbmgrJCZ2PuQZaK4in3gcg3o6rZ7WK6dr5vAA=",
"lastModified": 1751379130,
"narHash": "sha256-TObxiGbuX/4FbOnzDRvznfMUjIgS+d71+BetT35EOB8=",
"owner": "NixOS",
"repo": "nixos-hardware",
"rev": "98236410ea0fe204d0447149537a924fb71a6d4f",
"rev": "8b1f894089789eb39eacf0d6891d1e17cc3a84ab",
"type": "github"
},
"original": {
@ -630,11 +630,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1751011381,
"narHash": "sha256-krGXKxvkBhnrSC/kGBmg5MyupUUT5R6IBCLEzx9jhMM=",
"lastModified": 1751271578,
"narHash": "sha256-P/SQmKDu06x8yv7i0s8bvnnuJYkxVGBWLWHaU+tt4YY=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "30e2e2857ba47844aa71991daa6ed1fc678bcbb7",
"rev": "3016b4b15d13f3089db8a41ef937b13a9e33a8df",
"type": "github"
},
"original": {
@ -709,11 +709,11 @@
},
"nixpkgs_3": {
"locked": {
"lastModified": 1751011381,
"narHash": "sha256-krGXKxvkBhnrSC/kGBmg5MyupUUT5R6IBCLEzx9jhMM=",
"lastModified": 1751271578,
"narHash": "sha256-P/SQmKDu06x8yv7i0s8bvnnuJYkxVGBWLWHaU+tt4YY=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "30e2e2857ba47844aa71991daa6ed1fc678bcbb7",
"rev": "3016b4b15d13f3089db8a41ef937b13a9e33a8df",
"type": "github"
},
"original": {
@ -768,11 +768,11 @@
"nur-rycee": {
"flake": false,
"locked": {
"lastModified": 1751256218,
"narHash": "sha256-WC1YSV4lFT41AaEhpiQZRuofe+2WLI9PNuuqgdRmjVM=",
"lastModified": 1751342607,
"narHash": "sha256-p2w7cNkcIwEzKYhL1kjohU368rNqoDOwlDJZfSyZNWg=",
"owner": "rycee",
"repo": "nur-expressions",
"rev": "fa40d85b15cbfb1a488ef9a119ff2d40a481c8da",
"rev": "c0b09e83031df3bb3fc59cb1653035795273b222",
"type": "gitlab"
},
"original": {
@ -915,11 +915,11 @@
"tinted-zed": "tinted-zed"
},
"locked": {
"lastModified": 1751296480,
"narHash": "sha256-PMuzVs9khM7cYrjUCXQeV2OP6WVtbsmdZwa4Cc21y0o=",
"lastModified": 1751379237,
"narHash": "sha256-jDoLz04rgXS0jYLT017RARjcC7PoZoJ6NzH6ypi2kKM=",
"owner": "nix-community",
"repo": "stylix",
"rev": "4ead8043f70cc3b951e704a1f6e40c8a10230e61",
"rev": "4bc15ef13c970981e37506491e18d1158af9a70c",
"type": "github"
},
"original": {

View file

@ -7,18 +7,16 @@
rootPath = ./..;
inherit (self) outputs;
inherit (inputs) nixpkgs;
defaultNixosModule = import (rootPath + "/nixos/modules");
in {
flake = {
nixosModules.default = defaultNixosModule;
nixosModules = {
default = import (rootPath + "/nixos/modules/top-level");
gui = import (rootPath + "/nixos/modules/top-level/gui.nix");
};
nixosConfigurations = let
makeNixosConfiguration = hostName:
nixpkgs.lib.nixosSystem {
modules =
[defaultNixosModule]
++ [
(rootPath + "/nixos/configurations/${hostName}")
];
modules = [(rootPath + "/nixos/configurations/${hostName}")];
specialArgs = {
inherit inputs outputs rootPath;
};

View file

@ -14,15 +14,12 @@
inherit (email) address name;
signKey = email.gpg.key;
in {
firefox.enable = true;
fuzzel.enable = true;
gpg.enable = true;
git = {
inherit name signKey;
email = address;
encrypt-credential = true;
};
zed-editor.enable = true;
fish.enable = true;
bash.enable = true;
jujutsu = {
@ -30,15 +27,9 @@
inherit name signKey;
email = address;
};
ghostty.enable = true;
starship.enable = true;
sops.enable = true;
mpv.enable = true;
atuin.enable = true;
chromium.enable = true;
thunderbird.enable = true;
alacritty.enable = true;
# espanso.enable = true;
};
};
@ -46,8 +37,16 @@
wallpaper.enable = true;
accounts.email.enable = true;
programs = {
chromium.enable = true;
thunderbird.enable = true;
# espanso.enable = true;
mpv.enable = true;
ghostty.enable = true;
zed-editor.enable = true;
firefox.enable = true;
helix.enable = true;
openssh.enable = true;
alacritty.enable = true;
};
};

View file

@ -14,10 +14,7 @@
inherit (email) name address;
signKey = email.gpg.key;
in {
zed-editor.enable = true;
rustypaste-cli.enable = true;
firefox.enable = true;
fuzzel.enable = true;
gpg.enable = true;
jujutsu = {
enable = true;
@ -31,18 +28,11 @@
};
fish.enable = true;
bash.enable = true;
ghostty.enable = true;
foot.enable = false;
starship.enable = true;
sops.enable = true;
mpv.enable = true;
kvm.enable = true;
atuin.enable = true;
thunderbird.enable = true;
chromium.enable = true;
espanso.enable = true;
ion.enable = true;
alacritty.enable = true;
};
};
@ -50,6 +40,15 @@
wallpaper.enable = true;
accounts.email.enable = true;
programs = {
chromium.enable = true;
espanso.enable = true;
thunderbird.enable = true;
foot.enable = false;
mpv.enable = true;
ghostty.enable = true;
alacritty.enable = true;
zed-editor.enable = true;
firefox.enable = true;
openssh.enable = true;
helix.enable = true;
};

View file

@ -4,10 +4,10 @@
pkgs,
...
}: let
cfg = config.youthlic.programs.alacritty;
cfg = config.david.programs.alacritty;
in {
options = {
youthlic.programs.alacritty = {
david.programs.alacritty = {
enable = lib.mkEnableOption "alacritty";
};
};

View file

@ -3,10 +3,10 @@
config,
...
}: let
cfg = config.youthlic.programs.chromium;
cfg = config.david.programs.chromium;
in {
options = {
youthlic.programs.chromium = {
david.programs.chromium = {
enable = lib.mkEnableOption "chromium";
};
};

View file

@ -4,5 +4,19 @@
./niri
./wluma
./helix.nix
./firefox.nix
./waybar.nix
./zed.nix
./alacritty
./ghostty.nix
./fuzzel.nix
./mpv.nix
./swaylock.nix
./thunderbird.nix
./chromium.nix
./foot
./swaync.nix
./espanso.nix
./waypaper.nix
];
}

View file

@ -4,10 +4,10 @@
pkgs,
...
}: let
cfg = config.youthlic.programs.espanso;
cfg = config.david.programs.espanso;
in {
options = {
youthlic.programs.espanso = {
david.programs.espanso = {
enable = lib.mkEnableOption "espanso";
};
};

View file

@ -6,10 +6,10 @@
config,
...
}: let
cfg = config.youthlic.programs.firefox;
cfg = config.david.programs.firefox;
in {
options = {
youthlic.programs.firefox = {
david.programs.firefox = {
enable = lib.mkEnableOption "firefox";
};
};

View file

@ -3,10 +3,10 @@
lib,
...
}: let
cfg = config.youthlic.programs.foot;
cfg = config.david.programs.foot;
in {
options = {
youthlic.programs.foot = {
david.programs.foot = {
enable = lib.mkEnableOption "foot";
};
};

View file

@ -0,0 +1,24 @@
{
config,
lib,
...
}: let
cfg = config.david.programs.fuzzel;
in {
options = {
david.programs.fuzzel = {
enable = lib.mkEnableOption "fuzzel";
};
};
config = {
programs.fuzzel = lib.mkIf cfg.enable {
enable = true;
settings = {
main = {
prompt = "'λ '";
dpi-aware = true;
};
};
};
};
}

View file

@ -5,12 +5,12 @@
...
}: {
options = {
youthlic.programs.ghostty = {
david.programs.ghostty = {
enable = lib.mkEnableOption "ghostty";
};
};
config = let
cfg = config.youthlic.programs.ghostty;
cfg = config.david.programs.ghostty;
in (lib.mkIf cfg.enable {
programs.ghostty = lib.mkMerge [
{

View file

@ -12,6 +12,10 @@ in {
};
};
config = lib.mkIf cfg.enable {
stylix.targets.helix.enable = false;
programs.helix.settings = {
theme = "gruvbox_dark_hard";
};
youthlic.programs.helix = {
enable = true;
extraPackages = with pkgs; [

View file

@ -3,10 +3,10 @@
config,
...
}: let
cfg = config.youthlic.programs.mpv;
cfg = config.david.programs.mpv;
in {
options = {
youthlic.programs.mpv = {
david.programs.mpv = {
enable = lib.mkEnableOption "mpv";
};
};

View file

@ -3,9 +3,11 @@
lib,
inputs,
pkgs,
osConfig ? null,
...
} @ args: let
cfg = config.david.programs.niri;
niri = osConfig.programs.niri.package;
in {
options = {
david.programs.niri = {
@ -17,16 +19,59 @@ in {
};
config = lib.mkMerge [
{
david.programs.niri.enable = config.youthlic.programs.niri.enable;
david.programs.niri.enable = osConfig.youthlic.gui.enabled == "niri";
}
(
lib.mkIf cfg.enable {
youthlic.programs.niri = {
home.packages =
(with pkgs; [
swaynotificationcenter
kdePackages.polkit-kde-agent-1
wl-clipboard
cliphist
])
++ [niri];
qt = {
enable = true;
};
xdg.portal = {
configPackages = [niri];
enable = true;
extraPortals = lib.mkIf (
!niri.cargoBuildNoDefaultFeatures || builtins.elem "xdp-gnome-screencast" niri.cargoBuildFeatures
) [pkgs.xdg-desktop-portal-gnome];
};
xdg.configFile = let
qtctConf =
''
[Appearance]
standard_dialogs=xdgdesktopportal
''
+ lib.optionalString (config.qt.style ? name) ''
style=${config.qt.style.name}
'';
in {
"qt5ct/qt5ct.conf" = lib.mkForce {
text = qtctConf;
};
"qt6ct/qt6ct.conf" = lib.mkForce {
text = qtctConf;
};
};
david.programs = {
fuzzel.enable = true;
waybar.enable = true;
wluma.enable = true;
swaync.enable = true;
swaylock.enable = true;
waypaper.enable = true;
};
programs.niri = {
config =
(lib.toList (import ./config.nix (args // {inherit pkgs;})))
++ (lib.toList cfg.extraConfig);
package = niri;
};
david.programs.wluma.enable = true;
}
)
];

View file

@ -4,10 +4,10 @@
lib,
...
}: let
cfg = config.youthlic.programs.swaylock;
cfg = config.david.programs.swaylock;
in {
options = {
youthlic.programs.swaylock = {
david.programs.swaylock = {
enable = lib.mkEnableOption "swaylock";
};
};

View file

@ -3,10 +3,10 @@
config,
...
}: let
cfg = config.youthlic.programs.swaync;
cfg = config.david.programs.swaync;
in {
options = {
youthlic.programs.swaync = {
david.programs.swaync = {
enable = lib.mkEnableOption "swaync";
systemd.enable = lib.mkEnableOption "systemd service for swaync";
};

View file

@ -3,10 +3,10 @@
lib,
...
}: let
cfg = config.youthlic.programs.thunderbird;
cfg = config.david.programs.thunderbird;
in {
options = {
youthlic.programs.thunderbird = {
david.programs.thunderbird = {
enable = lib.mkEnableOption "thunderbird";
};
};

View file

@ -4,10 +4,10 @@
lib,
...
}: let
cfg = config.youthlic.programs.waybar;
cfg = config.david.programs.waybar;
in {
options = {
youthlic.programs.waybar = {
david.programs.waybar = {
enable = lib.mkEnableOption "waybar";
};
};

View file

@ -4,10 +4,10 @@
pkgs,
...
}: let
cfg = config.youthlic.programs.waypaper;
cfg = config.david.programs.waypaper;
in {
options = {
youthlic.programs.waypaper = {
david.programs.waypaper = {
enable = lib.mkEnableOption "waypaper";
};
};

View file

@ -11,6 +11,12 @@ in {
};
};
config = lib.mkIf cfg.enable {
youthlic.programs.wluma.config = ./config.toml;
services.wluma = {
enable = true;
settings = ./config.toml |> builtins.readFile |> builtins.fromTOML;
systemd = {
enable = true;
};
};
};
}

View file

@ -4,10 +4,10 @@
lib,
...
}: let
cfg = config.youthlic.programs.zed-editor;
cfg = config.david.programs.zed-editor;
in {
options = {
youthlic.programs.zed-editor = {
david.programs.zed-editor = {
enable = lib.mkEnableOption "zed-editor";
};
};

View file

@ -1,36 +1,20 @@
{...}: {
imports = [
./zed.nix
./rustypaste-cli.nix
./atuin.nix
./firefox.nix
./bash.nix
./fish.nix
./kvm.nix
./ghostty.nix
./wluma.nix
./niri.nix
./starship
./fuzzel.nix
./mpv.nix
./swaylock.nix
./thunderbird.nix
./chromium.nix
./gpg
./foot
./sops.nix
./git.nix
./swaync.nix
./helix
./waybar.nix
./jujutsu.nix
./espanso.nix
./yazi.nix
./zoxide.nix
./fzf.nix
./eza.nix
./ion.nix
./alacritty
./waypaper.nix
];
}

View file

@ -1,34 +0,0 @@
{
config,
lib,
...
}: let
cfg = config.youthlic.programs.fuzzel;
in {
options = {
youthlic.programs.fuzzel = {
enable = lib.mkEnableOption "fuzzel";
};
};
config = {
programs.fuzzel = lib.mkIf cfg.enable {
enable = true;
settings = {
main = {
# font = "LXGW WenKai:size=11";
prompt = "'λ '";
dpi-aware = true;
};
# colors = {
# background = "282a36dd";
# text = "f8f8f2ff";
# match = "8be9fdff";
# selection-match = "8be9fdff";
# selection = "44475add";
# selection-text = "f8f8f2ff";
# border = "bd93f9ff";
# };
};
};
};
}

View file

@ -1,5 +1,3 @@
theme = "gruvbox_dark_hard"
[editor]
line-number = "relative"
cursorline = true

View file

@ -24,7 +24,6 @@
config = let
cfg = config.youthlic.programs.helix;
in {
stylix.targets.helix.enable = false;
programs.helix = lib.mkIf cfg.enable {
enable = true;
defaultEditor = true;

View file

@ -1,76 +0,0 @@
{
pkgs,
config,
lib,
osConfig ? null,
inputs,
...
}: let
cfg = config.youthlic.programs.niri;
niri = osConfig.programs.niri.package;
in {
options = {
youthlic.programs.niri = {
enable = lib.mkEnableOption "niri";
config = lib.mkOption {
type = inputs.niri-flake.lib.kdl.types.kdl-document;
};
};
};
config = lib.mkMerge [
{
youthlic.programs.niri.enable = osConfig.youthlic.gui.enabled == "niri";
}
(
lib.mkIf cfg.enable {
home.packages =
(with pkgs; [
swaynotificationcenter
kdePackages.polkit-kde-agent-1
wl-clipboard
cliphist
])
++ [niri];
qt = {
enable = true;
};
xdg.portal = {
configPackages = [niri];
enable = true;
extraPortals = lib.mkIf (
!niri.cargoBuildNoDefaultFeatures || builtins.elem "xdp-gnome-screencast" niri.cargoBuildFeatures
) [pkgs.xdg-desktop-portal-gnome];
};
xdg.configFile = let
qtctConf =
''
[Appearance]
standard_dialogs=xdgdesktopportal
''
+ lib.optionalString (config.qt.style ? name) ''
style=${config.qt.style.name}
'';
in {
"qt5ct/qt5ct.conf" = lib.mkForce {
text = qtctConf;
};
"qt6ct/qt6ct.conf" = lib.mkForce {
text = qtctConf;
};
};
youthlic.programs = {
fuzzel.enable = true;
wluma.enable = true;
waybar.enable = true;
swaync.enable = true;
swaylock.enable = true;
waypaper.enable = true;
};
programs.niri = {
config = cfg.config;
package = niri;
};
}
)
];
}

View file

@ -1,55 +0,0 @@
{
config,
pkgs,
lib,
...
}: let
cfg = config.youthlic.programs.wluma;
in {
options = {
youthlic.programs.wluma = {
enable = lib.mkEnableOption "wluma";
config = lib.mkOption {
type = lib.types.path;
example = ./config.toml;
description = ''
path to config file of wluma
'';
};
package = lib.mkOption {
type = lib.types.package;
example = pkgs.wluam;
default = pkgs.wluma;
description = ''
package of wluma
'';
};
};
};
config = lib.mkIf cfg.enable {
home.packages = [
cfg.package
];
xdg.configFile."wluma/config.toml" = {
enable = true;
source = cfg.config;
};
systemd.user.services.wluma = {
Unit = {
Description = "Adjusting screen brightness based on screen contents and amount of ambient light";
PartOf = ["graphical-session.target"];
After = ["graphical-session.target"];
};
Service = {
ExecStart = ["${lib.getExe cfg.package}"];
Restart = "always";
EnvironmentFile = ["-%E/wluma/service.conf"];
PrivateNetwork = true;
PrivateMounts = false;
};
Install = {
WantedBy = ["graphical-session.target"];
};
};
};
}

View file

@ -1,6 +1,7 @@
{
inputs,
pkgs,
outputs,
...
}: {
imports =
@ -16,6 +17,8 @@
./users
./networking.nix
./disk-config.nix
outputs.nixosModules.gui
];
youthlic = {

View file

@ -1,4 +1,8 @@
{pkgs, ...}: {
{
pkgs,
outputs,
...
}: {
imports = [
./forgejo.nix
./networking.nix
@ -8,6 +12,8 @@
./disko-config.nix
./miniflux.nix
./radicle.nix
outputs.nixosModules.default
];
youthlic = {

View file

@ -1,6 +1,7 @@
{
pkgs,
inputs,
outputs,
...
}: {
imports =
@ -24,6 +25,8 @@
./hardware.nix
./specialisation/kde.nix
./specialisation/niri-hybrid.nix
outputs.nixosModules.gui
];
youthlic = {

View file

@ -1,43 +1,13 @@
{
pkgs,
inputs,
outputs,
...
}: {
imports =
(with inputs; [
niri-flake.nixosModules.niri
nixos-cosmic.nixosModules.default
home-manager.nixosModules.home-manager
dae.nixosModules.dae
sops-nix.nixosModules.sops
stylix.nixosModules.stylix
disko.nixosModules.disko
lix-module.nixosModules.default
chaotic.nixosModules.default
])
++ [
./containers
./deploy
./nix.nix
./home.nix
./sops.nix
./i18n.nix
./gui
./programs
./hardware.nix
];
config = {
nixpkgs = {
overlays = with outputs.overlays; [
modifications
additions
];
};
system.rebuild.enableNg = true;
environment.systemPackages = with pkgs; [
deploy-rs
];
};
imports = [
./containers
./deploy
./nix.nix
./home.nix
./sops.nix
./i18n.nix
./gui
./programs
./hardware.nix
];
}

View file

@ -0,0 +1,31 @@
{
pkgs,
inputs,
outputs,
...
}: {
imports = with inputs; [
home-manager.nixosModules.home-manager
dae.nixosModules.dae
sops-nix.nixosModules.sops
stylix.nixosModules.stylix
disko.nixosModules.disko
lix-module.nixosModules.default
chaotic.nixosModules.default
./..
];
config = {
nixpkgs = {
overlays = with outputs.overlays; [
modifications
additions
];
};
system.rebuild.enableNg = true;
environment.systemPackages = with pkgs; [
deploy-rs
];
};
}

View file

@ -0,0 +1,9 @@
{inputs, ...}: {
imports =
[
./.
]
++ (with inputs; [
niri-flake.nixosModules.niri
]);
}