feat: refactor
This commit is contained in:
parent
332a7dbfbe
commit
30286dbedb
13 changed files with 231 additions and 151 deletions
|
|
@ -1,6 +1,7 @@
|
|||
{
|
||||
lib,
|
||||
config,
|
||||
hostConfig,
|
||||
...
|
||||
}:
|
||||
|
||||
|
|
@ -8,13 +9,16 @@ let
|
|||
homeDir = config.home.homeDirectory;
|
||||
repoDir = "${homeDir}/.config/nix";
|
||||
|
||||
directories = [
|
||||
"dev"
|
||||
"dl"
|
||||
"img"
|
||||
"img/screen"
|
||||
"img/wp"
|
||||
];
|
||||
directories =
|
||||
[
|
||||
"dev"
|
||||
"dl"
|
||||
"img"
|
||||
]
|
||||
++ lib.optionals hostConfig.isLinux [
|
||||
"img/screen"
|
||||
"img/wp"
|
||||
];
|
||||
in
|
||||
{
|
||||
home.activation.createDirectories = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
|
||||
|
|
@ -29,15 +33,17 @@ in
|
|||
done
|
||||
'';
|
||||
|
||||
home.activation.linkWallpapers = lib.hm.dag.entryAfter [ "createDirectories" ] ''
|
||||
src="${repoDir}/config/screen"
|
||||
dest="$HOME/img/screen"
|
||||
if [ -d "$src" ]; then
|
||||
for f in "$src"/*; do
|
||||
[ -f "$f" ] || continue
|
||||
name=$(basename "$f")
|
||||
[ -L "$dest/$name" ] || $DRY_RUN_CMD ln -sf "$f" "$dest/$name"
|
||||
done
|
||||
fi
|
||||
'';
|
||||
home.activation.linkWallpapers = lib.mkIf hostConfig.isLinux (
|
||||
lib.hm.dag.entryAfter [ "createDirectories" ] ''
|
||||
src="${repoDir}/config/screen"
|
||||
dest="$HOME/img/screen"
|
||||
if [ -d "$src" ]; then
|
||||
for f in "$src"/*; do
|
||||
[ -f "$f" ] || continue
|
||||
name=$(basename "$f")
|
||||
[ -L "$dest/$name" ] || $DRY_RUN_CMD ln -sf "$f" "$dest/$name"
|
||||
done
|
||||
fi
|
||||
''
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
lib,
|
||||
config,
|
||||
pkgs,
|
||||
hostConfig,
|
||||
...
|
||||
}:
|
||||
|
||||
|
|
@ -139,7 +140,7 @@
|
|||
|
||||
programs.gpg.enable = true;
|
||||
|
||||
services.gpg-agent = {
|
||||
services.gpg-agent = lib.mkIf hostConfig.isLinux {
|
||||
enable = true;
|
||||
defaultCacheTtl = 3600;
|
||||
maxCacheTtl = 7200;
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
pkgs,
|
||||
lib,
|
||||
config,
|
||||
isNixOS,
|
||||
hostConfig,
|
||||
...
|
||||
}:
|
||||
|
||||
|
|
@ -13,21 +13,32 @@ let
|
|||
col.inactive_border = rgb(${builtins.substring 1 6 palette.bg})
|
||||
}
|
||||
'';
|
||||
|
||||
nvidiaEnv = lib.optionalString (hostConfig.gpu == "nvidia") ''
|
||||
env = LIBVA_DRIVER_NAME,nvidia
|
||||
env = __GLX_VENDOR_LIBRARY_NAME,nvidia
|
||||
env = NVD_BACKEND,direct
|
||||
env = GBM_BACKEND,nvidia-drm
|
||||
env = GSK_RENDERER,ngl
|
||||
env = __NV_PRIME_RENDER_OFFLOAD,1
|
||||
env = __VK_LAYER_NV_optimus,NVIDIA_only
|
||||
'';
|
||||
in
|
||||
{
|
||||
wayland.windowManager.hyprland = {
|
||||
enable = true;
|
||||
package = lib.mkIf (!isNixOS) null;
|
||||
portalPackage = lib.mkIf (!isNixOS) null;
|
||||
systemd.enable = isNixOS;
|
||||
package = lib.mkIf (!hostConfig.isNixOS) null;
|
||||
portalPackage = lib.mkIf (!hostConfig.isNixOS) null;
|
||||
systemd.enable = hostConfig.isNixOS;
|
||||
|
||||
extraConfig = ''
|
||||
${nvidiaEnv}
|
||||
source = $XDG_CONFIG_HOME/nix/config/hypr/hyprland.conf
|
||||
'';
|
||||
};
|
||||
|
||||
home.packages =
|
||||
lib.optionals isNixOS [
|
||||
lib.optionals hostConfig.isNixOS [
|
||||
pkgs.xdg-desktop-portal-gtk
|
||||
pkgs.hyprpaper
|
||||
]
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
lib,
|
||||
config,
|
||||
zen-browser,
|
||||
hostPlatform,
|
||||
hostConfig,
|
||||
...
|
||||
}:
|
||||
|
||||
|
|
@ -39,17 +39,21 @@ in
|
|||
with pkgs;
|
||||
[
|
||||
slack
|
||||
bitwarden-desktop
|
||||
gemini-cli
|
||||
typst
|
||||
libreoffice-fresh
|
||||
glab
|
||||
]
|
||||
++ lib.optionals zen [ zen-browser.packages.${hostPlatform}.default ]
|
||||
++ lib.optionals sioyek [ sioyek-wrapped ]
|
||||
++ lib.optionals vesktop [ pkgs.vesktop ]
|
||||
++ lib.optionals hostConfig.isLinux [
|
||||
bitwarden-desktop
|
||||
libreoffice-fresh
|
||||
]
|
||||
++ lib.optionals zen [ zen-browser.packages.${hostConfig.platform}.default ]
|
||||
++ lib.optionals sioyek [
|
||||
(if hostConfig.isLinux then sioyek-wrapped else pkgs.sioyek)
|
||||
]
|
||||
++ lib.optionals (vesktop && hostConfig.isLinux) [ pkgs.vesktop ]
|
||||
++ lib.optionals claude [ pkgs.claude-code ]
|
||||
++ lib.optionals signal [ pkgs.signal-desktop ];
|
||||
++ lib.optionals (signal && hostConfig.isLinux) [ pkgs.signal-desktop ];
|
||||
|
||||
xdg.configFile."claude/settings.json" = lib.mkIf claude {
|
||||
text = builtins.toJSON {
|
||||
|
|
@ -92,7 +96,7 @@ in
|
|||
source = config.lib.file.mkOutOfStoreSymlink "${repoDir}/config/sioyek/themes/daylight.config";
|
||||
};
|
||||
|
||||
home.activation.linkZenProfile = lib.mkIf zen (
|
||||
home.activation.linkZenProfile = lib.mkIf (zen && hostConfig.isLinux) (
|
||||
lib.hm.dag.entryAfter [ "writeBoundary" ] ''
|
||||
zen_config="$HOME/.zen"
|
||||
repo_zen="${repoDir}/config/zen"
|
||||
|
|
@ -135,12 +139,14 @@ in
|
|||
''
|
||||
);
|
||||
|
||||
xdg.configFile."electron-flags.conf".text = ''
|
||||
--enable-features=WaylandWindowDecorations
|
||||
--ozone-platform-hint=auto
|
||||
'';
|
||||
xdg.configFile."electron-flags.conf" = lib.mkIf hostConfig.isLinux {
|
||||
text = ''
|
||||
--enable-features=WaylandWindowDecorations
|
||||
--ozone-platform-hint=auto
|
||||
'';
|
||||
};
|
||||
|
||||
xdg.mimeApps = {
|
||||
xdg.mimeApps = lib.mkIf hostConfig.isLinux {
|
||||
enable = true;
|
||||
defaultApplications = lib.mkMerge [
|
||||
(lib.mkIf zen {
|
||||
|
|
@ -155,9 +161,9 @@ in
|
|||
"application/pdf" = "sioyek.desktop";
|
||||
"application/epub+zip" = "sioyek.desktop";
|
||||
})
|
||||
# (lib.mkIf vesktop {
|
||||
# "x-scheme-handler/discord" = "vesktop.desktop";
|
||||
# })
|
||||
(lib.mkIf vesktop {
|
||||
"x-scheme-handler/discord" = "vesktop.desktop";
|
||||
})
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
pkgs,
|
||||
lib,
|
||||
config,
|
||||
isNixOS,
|
||||
hostConfig,
|
||||
...
|
||||
}:
|
||||
|
||||
|
|
@ -28,7 +28,6 @@ in
|
|||
[
|
||||
awscli2
|
||||
pure-prompt
|
||||
xclip
|
||||
tree
|
||||
jq
|
||||
curl
|
||||
|
|
@ -43,6 +42,7 @@ in
|
|||
librsvg
|
||||
imagemagick
|
||||
]
|
||||
++ lib.optionals hostConfig.isLinux [ xclip ]
|
||||
++ lib.optionals rust [ rustup ];
|
||||
|
||||
home.sessionVariables = lib.mkMerge [
|
||||
|
|
@ -191,7 +191,7 @@ in
|
|||
dotDir = "${config.xdg.configHome}/zsh";
|
||||
completionInit = "";
|
||||
|
||||
profileExtra = ''
|
||||
profileExtra = lib.mkIf hostConfig.isLinux ''
|
||||
[ "$(tty)" = "/dev/tty1" ] && [ -z "$WAYLAND_DISPLAY" ] && start-hyprland
|
||||
'';
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
lib,
|
||||
config,
|
||||
pkgs,
|
||||
hostConfig,
|
||||
...
|
||||
}:
|
||||
|
||||
|
|
@ -69,7 +70,7 @@ in
|
|||
palettes = palettes;
|
||||
colors = palettes.${config.theme};
|
||||
|
||||
home.pointerCursor = {
|
||||
home.pointerCursor = lib.mkIf hostConfig.isLinux {
|
||||
name = "macOS";
|
||||
package = pkgs.apple-cursor;
|
||||
size = 24;
|
||||
|
|
@ -77,7 +78,7 @@ in
|
|||
x11.enable = false;
|
||||
};
|
||||
|
||||
gtk = {
|
||||
gtk = lib.mkIf hostConfig.isLinux {
|
||||
enable = true;
|
||||
font = {
|
||||
name = "SF Pro Display";
|
||||
|
|
@ -85,8 +86,10 @@ in
|
|||
};
|
||||
};
|
||||
|
||||
home.file.".local/share/fonts".source =
|
||||
config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/.config/nix/fonts";
|
||||
home.file.".local/share/fonts" = lib.mkIf hostConfig.isLinux {
|
||||
source =
|
||||
config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/.config/nix/fonts";
|
||||
};
|
||||
|
||||
home.activation.checkFonts = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
|
||||
if [ ! -d "${config.home.homeDirectory}/.config/nix/fonts" ] || \
|
||||
|
|
@ -102,9 +105,11 @@ in
|
|||
home.activation.linkTheme = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
|
||||
cfg="${config.xdg.configHome}"
|
||||
theme="${config.theme}"
|
||||
$DRY_RUN_CMD ln -sf "$cfg/hypr/themes/$theme.conf" "$cfg/hypr/themes/theme.conf"
|
||||
$DRY_RUN_CMD ln -sf "$cfg/waybar/themes/$theme.css" "$cfg/waybar/themes/theme.css"
|
||||
$DRY_RUN_CMD ln -sf "$cfg/rofi/themes/$theme.rasi" "$cfg/rofi/themes/theme.rasi"
|
||||
${lib.optionalString hostConfig.isLinux ''
|
||||
$DRY_RUN_CMD ln -sf "$cfg/hypr/themes/$theme.conf" "$cfg/hypr/themes/theme.conf"
|
||||
$DRY_RUN_CMD ln -sf "$cfg/waybar/themes/$theme.css" "$cfg/waybar/themes/theme.css"
|
||||
$DRY_RUN_CMD ln -sf "$cfg/rofi/themes/$theme.rasi" "$cfg/rofi/themes/theme.rasi"
|
||||
''}
|
||||
$DRY_RUN_CMD ln -sf "$cfg/sioyek/themes/$theme.config" "$cfg/sioyek/themes/theme.config"
|
||||
$DRY_RUN_CMD ln -sf "$cfg/fzf/themes/$theme" "$cfg/fzf/themes/theme"
|
||||
'';
|
||||
|
|
|
|||
|
|
@ -2,12 +2,12 @@
|
|||
pkgs,
|
||||
lib,
|
||||
config,
|
||||
hostConfig,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
c = config.colors;
|
||||
backlightDevice = "intel_backlight";
|
||||
|
||||
mkWaybarTheme = palette: ''
|
||||
* { color: ${palette.fg}; }
|
||||
|
|
@ -62,13 +62,14 @@ in
|
|||
"hyprland/window"
|
||||
];
|
||||
modules-center = [ ];
|
||||
modules-right = [
|
||||
"backlight"
|
||||
"pulseaudio"
|
||||
"network"
|
||||
"battery"
|
||||
"clock"
|
||||
];
|
||||
modules-right =
|
||||
lib.optional (hostConfig.backlightDevice != null) "backlight"
|
||||
++ [
|
||||
"pulseaudio"
|
||||
"network"
|
||||
"battery"
|
||||
"clock"
|
||||
];
|
||||
|
||||
"hyprland/workspaces" = {
|
||||
disable-scroll = true;
|
||||
|
|
@ -114,8 +115,8 @@ in
|
|||
tooltip-format-disconnected = "Network: disconnected";
|
||||
};
|
||||
|
||||
backlight = {
|
||||
device = backlightDevice;
|
||||
backlight = lib.mkIf (hostConfig.backlightDevice != null) {
|
||||
device = hostConfig.backlightDevice;
|
||||
format = "brightness:{percent}% │ ";
|
||||
signal = 1;
|
||||
tooltip = false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue