feat: refactoring configuration with options to make it more modular

This commit is contained in:
Ryan Yin
2023-12-23 19:34:13 +08:00
parent 1f08d10ac7
commit b75b79057b
106 changed files with 289 additions and 279 deletions

View File

@@ -1,6 +1,3 @@
{
imports = [
./shell.nix
./system-tools.nix
];
{mylib, ...}: {
imports = mylib.scanPaths ./.;
}

View File

@@ -1,8 +1,4 @@
{
config,
nushell-scripts,
...
}: let
{config, ...}: let
d = config.xdg.dataHome;
c = config.xdg.configHome;
cache = config.xdg.cacheHome;

View File

@@ -1,10 +1,10 @@
{
imports = [
../base/server
../base/desktop
../base/core.nix
./base
./fcitx5
./desktop
];
}

View File

@@ -0,0 +1,3 @@
{mylib, ...}: {
imports = mylib.scanPaths ./.;
}

View File

@@ -0,0 +1,30 @@
{
pkgs,
...
}: {
home.packages = with pkgs; [
# GUI apps
# e-book viewer(.epub/.mobi/...)
# do not support .pdf
foliate
# instant messaging
telegram-desktop
discord
qq # https://github.com/NixOS/nixpkgs/tree/master/pkgs/applications/networking/instant-messengers/qq
# remote desktop(rdp connect)
remmina
freerdp # required by remmina
# misc
flameshot
ventoy # multi-boot usb creator
];
# GitHub CLI tool
programs.gh = {
enable = true;
};
}

View File

@@ -1,38 +1,3 @@
{pkgs, ...}: {
imports = [
./wallpaper
./creative.nix
./gtk.nix
./immutable-file.nix
./media.nix
./ssh.nix
./xdg.nix
./eye-protection.nix
];
home.packages = with pkgs; [
# GUI apps
# e-book viewer(.epub/.mobi/...)
# do not support .pdf
foliate
# instant messaging
telegram-desktop
discord
qq # https://github.com/NixOS/nixpkgs/tree/master/pkgs/applications/networking/instant-messengers/qq
# remote desktop(rdp connect)
remmina
freerdp # required by remmina
# misc
flameshot
ventoy # multi-boot usb creator
];
# GitHub CLI tool
programs.gh = {
enable = true;
};
{mylib, ...}: {
imports = mylib.scanPaths ./.;
}

View File

@@ -3,10 +3,6 @@
anyrun,
...
}: {
imports = [
anyrun.homeManagerModules.default
];
programs.anyrun = {
enable = true;
config = {

View File

@@ -0,0 +1,30 @@
{
pkgs,
config,
lib,
anyrun,
...
} @ args:
with lib; let
cfg = config.modules.desktop.hyprland;
in {
imports = [
anyrun.homeManagerModules.default
];
options.modules.desktop.hyprland = {
enable = mkEnableOption "hyprland compositor";
};
config = mkIf cfg.enable (
mkMerge
(map
(path: import path args)
[
./hyprland.nix
./packages.nix
./anyrun.nix
./wayland-apps.nix
])
);
}

View File

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 32 KiB

View File

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

View File

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 23 KiB

View File

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 28 KiB

View File

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 32 KiB

View File

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

View File

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 27 KiB

View File

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

View File

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 26 KiB

View File

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 34 KiB

View File

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 29 KiB

View File

Before

Width:  |  Height:  |  Size: 33 KiB

After

Width:  |  Height:  |  Size: 33 KiB

View File

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 27 KiB

View File

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB

View File

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

View File

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 23 KiB

View File

Before

Width:  |  Height:  |  Size: 8.4 KiB

After

Width:  |  Height:  |  Size: 8.4 KiB

View File

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

View File

Before

Width:  |  Height:  |  Size: 5.8 KiB

After

Width:  |  Height:  |  Size: 5.8 KiB

View File

Before

Width:  |  Height:  |  Size: 7.8 KiB

After

Width:  |  Height:  |  Size: 7.8 KiB

View File

Before

Width:  |  Height:  |  Size: 5.7 KiB

After

Width:  |  Height:  |  Size: 5.7 KiB

View File

Before

Width:  |  Height:  |  Size: 7.0 KiB

After

Width:  |  Height:  |  Size: 7.0 KiB

View File

@@ -1,16 +1,10 @@
{
lib,
pkgs,
lib,
hyprland,
nur-ryan4yin,
...
}: {
imports = [
./anyrun.nix
./wayland-apps.nix
./packages.nix
];
# NOTE:
# We have to enable hyprland/i3's systemd user service in home-manager,
# so that gammastep/wallpaper-switcher's user service can be start correctly!

View File

@@ -8,7 +8,7 @@
commandLineArgs = [
# make it use GTK_IM_MODULE if it runs with Gtk4, so fcitx5 can work with it.
# (only supported by chromium/chrome at this time, not electron)
"--gtk-version=5"
"--gtk-version=4"
"--enable-features=UseOzonePlatform"
"--ozone-platform=wayland"
# make it use text-input-v1, which works for kwin 5.27 and weston

View File

@@ -0,0 +1,24 @@
{
pkgs,
config,
lib,
...
} @ args:
with lib; let
cfg = config.modules.desktop.i3;
in {
options.modules.desktop.i3 = {
enable = mkEnableOption "i3 window manager";
};
config = mkIf cfg.enable (
mkMerge
(map
(path: import path args)
[
./i3.nix
./packages.nix
./x11-apps.nix
])
);
}

View File

@@ -1,11 +1,6 @@
_: {
# i3 window manager's config, based on https://github.com/endeavouros-team/endeavouros-i3wm-setup
imports = [
./packages.nix
./x11-apps.nix
];
# NOTE:
# We have to enable hyprland/i3's systemd user service in home-manager,
# so that gammastep/wallpaper-switcher's user service can be start correctly!
@@ -14,7 +9,7 @@ _: {
enable = true;
windowManager.i3 = {
enable = true;
extraConfig = builtins.readFile ./config;
extraConfig = builtins.readFile ./i3-config;
};
# Path, relative to HOME, where Home Manager should write the X session script.
# and NixOS will use it to start xorg session when system boot up