update: fixed issues and update flake inputs

This commit is contained in:
danny 2025-12-29 16:03:31 +08:00
parent 4b6183f0ec
commit b3c5ad2880
80 changed files with 3307 additions and 2059 deletions

View file

@ -1,209 +0,0 @@
{
pkgs,
lib,
...
}:
let
caelestiaDot = pkgs.fetchFromGitHub {
owner = "caelestia-dots";
repo = "caelestia";
rev = "main";
sha256 = "sha256-pRLcbh81iBp9fH3Zq7HrNtAfDD46ErGZ3wID8Q65Wlg=";
};
in
{
home.packages = with pkgs; [
cliphist
inotify-tools
app2unit
wireplumber
trash-cli
foot
fastfetch
jq
socat
imagemagick
papirus-icon-theme
nerd-fonts.jetbrains-mono
fuzzel
];
xdg.configFile = {
"hypr/hyprland".source = "${caelestiaDot}/hypr/hyprland";
"hypr/scheme" = {
source = "${caelestiaDot}/hypr/scheme";
recursive = true;
};
"hypr/scripts" = {
source = "${caelestiaDot}/hypr/scripts";
executable = true;
};
"hypr/variables.conf".source = "${caelestiaDot}/hypr/variables.conf";
};
wayland.windowManager.hyprland = {
settings = {
"$hypr" = "~/.config/hypr";
"$hl" = "$hypr/hyprland";
"$cConf" = "~/.config/caelestia";
# ### Hyprland ###
# Apps
"$terminal" = "ghostty";
"$browser" = "nvidia-offload zen";
"$editor" = "nvim";
"$fileExplorer" = "yazi";
# Touchpad
"$touchpadDisableTyping" = "true";
"$touchpadScrollFactor" = "0.3";
"$workSpaceSwipeFingers" = "4";
# Blur
"$blurEnabled" = "true";
"$blurSpecialWs" = "false";
"$blurPopups" = "true";
"$blurInputMethods" = "true";
"$blurSize" = "8";
"$blurPasses" = "2";
"$blurXray" = "false";
# Shadow
"$shadowEnabled" = "true";
"$shadowRange" = "20";
"$shadowRenderPower" = "3";
"$shadowColour" = "rgba($surfaced4)";
# Gaps
"$workspaceGaps" = "20";
"$windowGapsIn" = "10";
"$windowGapsOut" = "10";
"$singleWindowGapsOut" = "10";
# Window styling
"$windowOpacity" = "0.95";
"$windowRounding" = "10";
"$windowBorderSize" = "3";
"$activeWindowBorderColour" = "rgba($primarye6)";
"$inactiveWindowBorderColour" = "rgba($onSurfaceVariant11)";
# Misc
"$volumeStep" = "5 # In percent";
"$kbGoToWs" = "SUPER";
"$wsaction" = "~/.config/hypr/scripts/wsaction.fish";
source = [
"$hypr/scheme/current.conf"
"$hl/env.conf"
"$hl/input.conf"
"$hl/misc.conf"
"$hl/animations.conf"
"$hl/decoration.conf"
"$hl/group.conf"
"$hl/rules.conf"
"${pkgs.writeText "keybinds.conf" ''
exec = hyprctl dispatch submap global
submap = global
# ## Shell keybinds
# Launcher
bind = Super+CTRL, K, global, caelestia:showall
bindi = Super, Super_L, global, caelestia:launcher
bindin = Super, catchall, global, caelestia:launcherInterrupt
bindin = Super, mouse:272, global, caelestia:launcherInterrupt
bindin = Super, mouse:273, global, caelestia:launcherInterrupt
bindin = Super, mouse:274, global, caelestia:launcherInterrupt
bindin = Super, mouse:275, global, caelestia:launcherInterrupt
bindin = Super, mouse:276, global, caelestia:launcherInterrupt
bindin = Super, mouse:277, global, caelestia:launcherInterrupt
bindin = Super, mouse_up, global, caelestia:launcherInterrupt
bindin = Super, mouse_down, global, caelestia:launcherInterrupt
bind = Super, DELETE, global, caelestia:lock
bind = Super, Q, killactive,
bind = Super , RETURN, exec, app2unit -- $terminal
bind = Super, F, exec, app2unit -- $browser
bind = Super, V, togglefloating,
bind = Super, P, pseudo
bind = Super, S, togglesplit
bindl = , XF86AudioPlay, global, caelestia:mediaToggle
bindl = , XF86AudioPause, global, caelestia:mediaToggle
bindl = , XF86AudioNext, global, caelestia:mediaNext
bindl = , XF86AudioPrev, global, caelestia:mediaPrev
bindl = , XF86AudioStop, global, caelestia:mediaStop
bind = Super+SHIFT, s, global, caelestia:screenshot
bind = CTRL SHIFT, s, exec, hyprshot -m window
bind = CTRL SHIFT Super, s, exec, hyprshot -m output
bind = CTRL ALT, s, exec, hyprshot -m active -m window
bindl = , XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle
bindle = , XF86AudioRaiseVolume, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ 0; wpctl set-volume -l 1 @DEFAULT_AUDIO_SINK@ $volumeStep%+
bindle = , XF86AudioLowerVolume, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ 0; wpctl set-volume @DEFAULT_AUDIO_SINK@ $volumeStep%-
bind = Super, Period, exec, pkill fuzzel || caelestia emoji -p
bind = Super+Shift, V, exec, pkill fuzzel || caelestia clipboard
''}"
];
bindm = [
# Move/resize windows with mainMod + LMB/RMB and dragging
''SUPER, mouse:272, movewindow''
''SUPER, mouse:273, resizewindow''
];
exec = [
"cp -L --no-preserve=mode --update=none $hypr/scheme/default.conf $hypr/scheme/current.conf"
];
misc = {
vrr = 0;
vfr = true;
};
};
};
home.activation.writeConfigFile =
lib.hm.dag.entryAfter [ "writeBoundary" ]
# bash
''
configList=("btop" "fastfetch" "thunar")
for config in "''\${configList[@]}"; do
if [ ! -d "$XDG_CONFIG_HOME/$config" ]; then
install -Dm666 "${caelestiaDot}/$config" "$XDG_CONFIG_HOME/$config"
fi
done
'';
fonts.fontconfig.enable = true;
programs.caelestia = {
enable = true;
settings = { };
cli = {
enable = true;
settings = { };
};
};
gtk = {
enable = lib.mkDefault true;
iconTheme = {
name = lib.mkDefault "Papirus-Dark";
package = lib.mkDefault pkgs.papirus-icon-theme;
};
};
systemd.user.services.caelestia = {
Service = {
Environment = [
"QT_QPA_PLATFORMTHEME=gtk3"
];
};
};
services.swww.enable = lib.mkForce false;
programs.waybar.enable = lib.mkForce false;
services.swaync.enable = lib.mkForce false;
}

View file

@ -5,7 +5,6 @@
}:
let
configDir = ../config;
browser = "zen.desktop";
in
{
home.file."${config.home.homeDirectory}/.config/starship.toml".source =
@ -21,20 +20,5 @@ in
};
};
xdg.mimeApps = {
enable = true;
associations.added = {
"application/pdf" = [ browser ];
"image/jpeg" = [ browser ];
"image/png" = [ browser ];
};
defaultApplications = {
"text/html" = browser;
"application/pdf" = [ browser ];
"image/jpeg" = [ browser ];
"image/png" = [ browser ];
"x-scheme-handler/http" = browser;
"x-scheme-handler/https" = browser;
};
};
xdg.mimeApps.enable = true;
}

55
home/user/ghostty.nix Normal file
View file

@ -0,0 +1,55 @@
{
inputs,
pkgs,
lib,
...
}:
let
inherit (pkgs.stdenv.hostPlatform) system;
inherit (lib) mkDefault;
ghosttyShaders = pkgs.fetchFromGitHub {
owner = "sahaj-b";
repo = "ghostty-cursor-shaders";
rev = "main";
hash = "sha256-ruhEqXnWRCYdX5mRczpY3rj1DTdxyY3BoN9pdlDOKrE=";
};
in
{
programs.ghostty = {
enable = true;
installBatSyntax = true;
enableFishIntegration = true;
package = inputs.ghostty.packages.${system}.default;
clearDefaultKeybinds = false;
settings = {
custom-shader = [
"${ghosttyShaders}/cursor_sweep.glsl"
"${ghosttyShaders}/ripple_cursor.glsl"
];
unfocused-split-opacity = 0.85;
desktop-notifications = true;
background-opacity = mkDefault 0.6;
background-blur = 20;
wait-after-command = false;
shell-integration = "detect";
window-theme = "dark";
confirm-close-surface = false;
window-decoration = false;
mouse-hide-while-typing = true;
keybind = [
"ctrl+shift+zero=toggle_tab_overview"
"ctrl+shift+9=reload_config"
"ctrl+shift+o=unbind"
];
clipboard-read = "allow";
clipboard-write = "allow";
};
};
}

View file

@ -3,11 +3,15 @@
osConfig,
config,
pkgs,
helper,
...
}:
with builtins;
let
inherit (osConfig.systemConf.hyprland) monitors;
inherit (helper) getMonitors;
inherit (osConfig.networking) hostName;
monitors = getMonitors hostName config;
nvidia-offload-enabled = osConfig.hardware.nvidia.prime.offload.enableOffloadCmd;
notransTag = "notrans";

View file

@ -67,13 +67,11 @@ let
"match:class ^(it.mijorus.smile)"
"match:class ^(xdg-desktop-portal-gtk)$"
"match:class ^(vesktop)$, match:title ^(Discord Popout)$"
"match:class ^(steam)$, match:title ^(Friends List)$"
"match:title (Open File)"
"match:title branchdialog"
"match:title wlogout"
"match:title ^(Media viewer)$"
"match:title ^(File Operation Progress)$"
"match:title ^(Steam Settings)$"
"match:title ^(Picture-in-Picture)$"
];
@ -91,8 +89,11 @@ let
# Steam
"match:class ^(steam)$" = [
"workspace 7 silent"
"workspace unset, match:float true"
"workspace 7 silent"
"float true, match:title ^(Friends List)$"
"float true, match:title ^(Steam Settings)$"
"center true, match:float true"
];
};
@ -113,6 +114,7 @@ in
"pin true, match:class ^(vesktop)$, match:title ^(Discord Popout)$"
# steam game
"workspace 7 silent, match:class ^(steam_app_)(.*)"
"fullscreen true, match:class ^(steam_app_)(.*)"
# VLC
"workspace 3, match:initial_class ^(vlc), match:float false"
# discord

View file

@ -1,12 +1,21 @@
{ osConfig, ... }:
{
osConfig,
helper,
config,
...
}:
let
inherit (osConfig.systemConf.hyprland) monitors;
inherit (helper) getMonitors;
inherit (osConfig.networking) hostName;
monitors = getMonitors hostName config;
inherit (builtins)
length
genList
toString
elemAt
;
monitorNum = length monitors;
workspaceNum = 10;
workspaceList = genList (
@ -15,7 +24,7 @@ let
currentNum = index - (monitorNum * (index / monitorNum));
default = if index < monitorNum then "true" else "false";
in
"${toString (index + 1)}, monitor:desc:${(elemAt monitors currentNum).desc}, default:${default}"
"${toString (index + 1)}, monitor:desc:${(elemAt monitors currentNum).criteria}, default:${default}"
) workspaceNum;
in
{

View file

@ -1,16 +1,11 @@
{
pkgs,
lib,
inputs,
config,
osConfig,
...
}:
let
inherit (lib) mkForce escapeShellArgs getExe';
inherit (pkgs.stdenv.hostPlatform) system;
inherit (osConfig.systemConf) username;
inherit (osConfig.systemConf.hyprland) monitors;
terminal = "ghostty";
execOnceScript = pkgs.writeShellScript "hyprlandExecOnce" ''
@ -26,22 +21,10 @@ let
'';
mainMod = "SUPER";
getCurrentSong = pkgs.writeShellScript "getSong" ''
song_info=$(playerctl metadata --format '{{title}} 󰎆 {{artist}}')
echo "$song_info"
'';
in
{
home.packages = with pkgs; [
mpvpaper # Video Wallpaper
hyprcursor
libnotify
sunsetr
];
systemd.user.tmpfiles.rules = [
"d ${config.home.homeDirectory}/Pictures/Wallpapers 0744 ${username} users -"
];
imports = [
@ -101,11 +84,6 @@ in
''${mainMod} CTRL, j, resizeactive, 0 ${resizeStep}''
];
monitor = [
", prefered, 0x0, 1"
]
++ (map (x: "desc:${x.desc},${x.props}") osConfig.systemConf.hyprland.monitors);
plugin = {
hyprwinrap = {
class = "kitty-bg";
@ -137,441 +115,4 @@ in
};
};
};
# === Awww === #
services.swww = {
enable = true;
package = inputs.awww.packages.${system}.awww;
};
systemd.user.services.swww.Service.ExecStart =
mkForce "${getExe' config.services.swww.package "awww-daemon"} ${escapeShellArgs config.services.swww.extraArgs}";
# === hyprlock === #
programs.hyprlock = {
enable = true;
package = inputs.hyprlock.packages.${system}.default;
importantPrefixes = [
"$"
"monitor"
"size"
"source"
];
settings =
let
font = "CaskaydiaCove Nerd Font";
font2 = "SF Pro Display Bold";
mainMonitor =
if ((builtins.length monitors) > 0) then "desc:${(builtins.elemAt monitors 0).desc}" else "";
in
{
background = {
monitor = "";
path = "screenshot";
blur_passes = 3;
blur_size = 8;
contrast = 0.8916;
brightness = 0.8172;
vibrancy = 0.1696;
vibrancy_darkness = 0.0;
};
# GENERAL
general = {
no_fade_in = false;
grace = 0;
disable_loading_bar = false;
ignore_empty_input = true;
fail_timeout = 1000;
};
# TIME
label = [
{
monitor = "${mainMonitor}";
text = ''cmd[update:1000] echo "$(date +"%-I:%M%p")"'';
color = "rgba(250, 189, 47, .75)";
font_size = 120;
font_family = "${font2}";
position = "0, -140";
halign = "center";
valign = "top";
}
# DAY-DATE-MONTH
{
monitor = "${mainMonitor}";
text = ''cmd[update:1000] echo "<span>$(date '+%A, %d %B')</span>"'';
color = "rgba(225, 225, 225, 0.75)";
font_size = 30;
font_family = "${font2}";
position = "0, 200";
halign = "center";
valign = "center";
}
# USER
{
monitor = "${mainMonitor}";
text = "Hello, $USER";
color = "rgba(255, 255, 255, .65)";
font_size = 25;
font_family = "${font2}";
position = "0, -70";
halign = "center";
valign = "center";
}
# Current Song
{
monitor = "${mainMonitor}";
text = ''cmd[update:1000] echo "$(${getCurrentSong})"'';
color = "rgba(235, 219, 178, .75)";
font_size = 16;
font_family = "${font}, ${font2}";
position = "0, 80";
halign = "center";
valign = "bottom";
}
];
# LOGO
image = {
monitor = "${mainMonitor}";
path = "$HOME/.face";
border_size = 2;
border_color = "rgba(255, 255, 255, .75)";
size = 95;
rounding = -1;
rotate = 0;
reload_time = -1;
reload_cmd = "";
position = "0, 60";
halign = "center";
valign = "center";
};
# INPUT FIELD
input-field = lib.mkForce [
{
monitor = "${mainMonitor}";
size = "290, 60";
outline_thickness = 2;
dots_size = 0.2; # Scale of input-field height, 0.2 - 0.8
dots_spacing = 0.2; # Scale of dots' absolute size, 0.0 - 1.0
dots_center = true;
outer_color = "rgba(0, 0, 0, 0)";
inner_color = "rgba(60, 56, 54, 0.35)";
font_color = "rgb(200, 200, 200)";
fail_color = "rgba(218, 53, 50, 0.56)";
fade_on_empty = false;
font_family = "${font2}";
placeholder_text = ''<i><span foreground="##ffffff99">Bruh, come back!</span></i>'';
hide_input = false;
position = "0, -140";
halign = "center";
valign = "center";
}
];
};
};
# === hypridle === #
services.hypridle = {
enable = true;
settings = {
general = {
lock_cmd = "pidof hyprlock || hyprlock";
before_sleep_cmd = "loginctl lock-session";
after_sleep_cmd = "hyprctl dispatch dpms on";
ignore_dbus_inhibit = false;
ignore_systemd_inhibit = false;
};
listener = [
# 2.5min -> set monitor backlight to minimum
{
timeout = 150;
on-timeout = "brightnessctl -s set 10";
on-resume = "brightnessctl -r";
}
# 2.5min -> turn off keyboard backlight
{
timeout = 150;
on-timeout = "brightnessctl -sd rgb:kbd_backlight set 0";
on-resume = "brightnessctl -rd rgb:kbd_backlight";
}
# 5min -> Lock screen
{
timeout = 300;
on-timeout = "loginctl lock-session";
}
# 5.5min -> Screen off
{
timeout = 330;
on-timeout = "hyprctl dispatch dpms off";
on-resume = "hyprctl dispatch dpms on";
}
# 30min -> Suspend pc
# {
# timeout = 1800;
# on-timeout = "systemctl suspend";
# }
];
};
};
# === sunsetr === #
systemd.user.services.sunsetr = {
Install = {
WantedBy = [ "graphical-session.target" ];
};
Unit = {
ConditionEnvironment = "WAYLAND_DISPLAY";
Description = "Blue light filter";
};
Service = {
ExecStart = "${pkgs.sunsetr}/bin/sunsetr";
Restart = "always";
RestartSec = 2;
};
};
# === swaync === #
services.swaync = {
enable = true;
package = (
pkgs.swaynotificationcenter.overrideAttrs (prev: rec {
version = "0.12.1";
buildInputs =
prev.buildInputs
++ (with pkgs; [
libhandy
pantheon.granite
gtk-layer-shell
]);
src = pkgs.fetchFromGitHub {
owner = "ErikReider";
repo = "SwayNotificationCenter";
rev = "v${version}";
hash = "sha256-kRawYbBLVx0ie4t7tChkA8QJShS83fUcGrJSKkxBy8Q=";
};
})
);
settings = {
control-center-height = 900;
control-center-margin-bottom = 20;
control-center-margin-left = 20;
control-center-margin-right = 20;
control-center-margin-top = 20;
control-center-width = 500;
fit-to-screen = true;
hide-on-action = true;
hide-on-clear = true;
image-visibility = "when-available";
keyboard-shortcuts = true;
layer = "overlay";
notification-body-image-height = 100;
notification-body-image-width = 200;
notification-icon-size = 64;
notification-window-width = 490;
positionX = "right";
positionY = "top";
script-fail-notify = true;
timeout = 3;
timeout-critical = 0;
timeout-low = 2;
transition-time = 200;
widgets = lib.mkForce [
"title"
"notifications"
"mpris"
];
};
style = # css
''
@define-color bgc rgba(0, 0, 0, 0.1);
@define-color borderc #ebdbb2;
@define-color textc #212121;
* {
font-family: ${osConfig.stylix.fonts.sansSerif.name};
font-size: ${toString osConfig.stylix.fonts.sizes.desktop}px;
font-weight: bold;
border-width: 3px;
border-color: #ebdbb2;
}
.control-center .notification-row:focus,
.control-center .notification-row:hover {
opacity: 1;
background: @bgc;
}
.notification-row {
outline: none;
margin: 5px;
padding: 0;
}
.notification {
background: @bgc;
margin: 0px;
border-radius: 6px;
border-width: 3px;
border-color: @borderc;
}
.notification-content {
background: @bgc;
padding: 7px;
margin: 0;
}
.close-button {
background: @bgc;
color: @borderc;
text-shadow: none;
padding: 0;
border-radius: 20px;
margin-top: 9px;
margin-right: 5px;
}
.close-button:hover {
box-shadow: none;
background: @borderc;
color: @textc;
transition: all .15s ease-in-out;
border: none;
}
.notification-action {
color: @borderc;
background: @bgc;
}
.notification-action:hover {
color: @textc;
background: @borderc;
}
.summary {
padding-top: 7px;
font-size: 13px;
color: @borderc;
}
.time {
font-size: 11px;
color: @borderc;
margin-right: 40px;
}
.body {
font-size: 12px;
color: @borderc;
}
.control-center {
background-color: @bgc;
border-radius: 20px;
}
.control-center-list {
background: transparent;
}
.control-center-list-placeholder {
opacity: .5;
}
.floating-notifications {
background: transparent;
}
.blank-window {
background: alpha(black, 0.1);
}
.widget-title {
color: @borderc;
padding: 10px 10px;
margin: 10px 10px 5px 10px;
font-size: 1.5rem;
}
.widget-title>button {
font-size: 1rem;
color: @borderc;
padding: 10px;
text-shadow: none;
background: @bgc;
box-shadow: none;
border-radius: 5px;
}
.widget-title>button:hover {
background: @borderc;
color: @textc;
}
.widget-label {
margin: 10px 10px 10px 10px;
}
.widget-label>label {
font-size: 1rem;
color: @borderc;
}
.widget-mpris {
color: @borderc;
padding: 5px 5px 5px 5px;
margin: 10px;
border-radius: 20px;
}
.widget-mpris>box>button {
border-radius: 20px;
}
.widget-mpris-player {
padding: 5px 5px;
margin: 10px;
}
'';
};
# === rofi === #
programs.rofi = {
enable = true;
package = pkgs.rofi;
plugins = with pkgs; [
rofi-emoji
rofi-calc
];
};
home.sessionVariables = {
NIXOS_OZONE_WL = "1";
NIXOS_XDG_OPEN_USE_PORTAL = "1";
GDK_BACKEND = "wayland";
QT_SCALE_FACTOR = "1";
QT_QPA_PLATFORM = "wayland-egl";
QT_WAYLAND_DISABLE_WINDOWDECORATION = "1";
QT_AUTO_SCREEN_SCALE_FACTOR = "1";
QT_IM_MODULES = "wayland;fcitx;ibus";
MOZ_ENABLE_WAYLAND = "1";
SDL_VIDEODRIVER = "wayland";
WLR_NO_HARDWARE_CURSORS = "1";
CLUTTER_BACKEND = "wayland";
EGL_PLATFORM = "wayland";
XDG_CURRENT_DESKTOP = "Hyprland";
XDG_SESSION_DESKTOP = "Hyprland";
XDG_SESSION_TYPE = "wayland";
};
}

View file

@ -342,6 +342,15 @@ in
documentDiagnostics = "<Leader>xx";
};
};
servers.nix.init_options = {
nixos.expr =
# nix
''(builtins.getFlake "/etc/nixos").nixosConfigurations.${osConfig.networking.hostName}.options'';
home_manager.expr =
# nix
''(builtins.getFlake "/etc/nixos").nixosConfigurations.${osConfig.networking.hostName}.options.home-manager.users.type.getSubOptions []'';
};
};
debugger = {
@ -354,8 +363,10 @@ in
formatter = {
conform-nvim = {
enable = true;
setupOpts.formatters_by_ft = {
nix = [ "nixfmt" ];
setupOpts = {
formatters_by_ft = {
nix = [ "nixfmt" ];
};
};
};
};
@ -404,23 +415,13 @@ in
enable = true;
extraDiagnostics.enable = false;
format.enable = false; # Manually configured in conform-nvim
lsp = {
server = "nixd";
options = {
nixos.expr =
# nix
''(builtins.getFlake "/etc/nixos").nixosConfigurations.${osConfig.networking.hostName}.options'';
home_manager.expr =
# nix
''(builtins.getFlake "/etc/nixos").nixosConfigurations.${osConfig.networking.hostName}.options.home-manager.users.type.getSubOptions []'';
};
};
lsp.servers = [ "nixd" ];
};
sql.enable = true;
clang.enable = true;
ts = {
enable = true;
format.type = "prettierd";
format.type = [ "prettierd" ];
extensions = {
ts-error-translator.enable = true;
};

View file

@ -1,17 +1,9 @@
{
pkgs,
inputs,
...
}:
let
inherit (pkgs.stdenv.hostPlatform) system;
md2html = pkgs.callPackage ../scripts/md2html.nix { };
ghosttyShaders = pkgs.fetchFromGitHub {
owner = "sahaj-b";
repo = "ghostty-cursor-shaders";
rev = "main";
hash = "sha256-ruhEqXnWRCYdX5mRczpY3rj1DTdxyY3BoN9pdlDOKrE=";
};
in
{
programs.btop = {
@ -22,61 +14,12 @@ in
};
};
programs.ghostty = {
enable = true;
installBatSyntax = true;
enableFishIntegration = true;
package = inputs.ghostty.packages.${system}.default;
settings = {
custom-shader = [
"${ghosttyShaders}/cursor_sweep.glsl"
"${ghosttyShaders}/ripple_cursor.glsl"
];
unfocused-split-opacity = 0.85;
desktop-notifications = false;
background-opacity = 0.4;
background-blur = false;
wait-after-command = false;
shell-integration = "detect";
window-theme = "dark";
confirm-close-surface = false;
window-decoration = false;
mouse-hide-while-typing = true;
keybind = [
"ctrl+shift+zero=toggle_tab_overview"
"ctrl+shift+e=unbind"
"ctrl+shift+o=unbind"
];
clipboard-read = "allow";
clipboard-write = "allow";
};
};
home.packages = with pkgs; [
obsidian
# Discord
# vesktop
discord
# Dev stuff
(python3.withPackages (python-pkgs: [
python-pkgs.pip
python-pkgs.requests
]))
# Work stuff
libreoffice-qt
pandoc
# Bluetooth
blueberry
# Downloads
qbittorrent
@ -85,9 +28,6 @@ in
cava
papirus-folders
inkscape
# PDF Preview
poppler
trash-cli
# File Manager

6
home/user/podman.nix Normal file
View file

@ -0,0 +1,6 @@
{ ... }:
{
services.podman = {
enable = true;
};
}

View file

@ -1,31 +0,0 @@
{ pkgs, ... }:
{
home.packages = with pkgs; [
quickshell
];
systemd.user.services.quickshell = {
Unit = {
Description = "Quickshell";
After = [ "graphical-session.target" ];
PartOf = [ "graphical-session.target" ];
};
Service = {
type = "exec";
ExecStart = "${pkgs.quickshell}/bin/quickshell";
Restart = "on-failure";
RestartSec = "5s";
TimeoutStopSec = "5s";
Environment = [
"QT_QPA_PLATFORM=wayland"
];
Slice = "session.slice";
};
Install = {
WantedBy = [ "graphical-session.target" ];
};
};
}

View file

@ -23,6 +23,12 @@ in
enable = true;
interactiveShellInit = ''
set fish_greeting # Disable greeting
# ==== Prevent Running Everything on GPU ==== #
set -e __NV_PRIME_RENDER_OFFLOAD
set -e __NV_PRIME_RENDER_OFFLOAD_PROVIDER
set -e __GLX_VENDOR_LIBRARY_NAME
set -e __VK_LAYER_NV_optimus
'';
plugins = [
{

View file

@ -16,6 +16,11 @@ let
--sudo --ask-sudo-password $@'';
rebuild = pkgs.writeShellScriptBin "rebuild" ''
${rebuildCommand}
'';
# Notification
nrebuild = pkgs.writeShellScriptBin "nrebuild" ''
${
if shouldNotify then
''
@ -36,6 +41,7 @@ let
in
{
home.packages = [
nrebuild
rebuild
];

View file

@ -0,0 +1,71 @@
{
pkgs,
lib,
osConfig,
config,
...
}:
let
inherit (lib) mkForce hasAttr;
prefix = if osConfig.hardware.nvidia.prime.offload.enableOffloadCmd then "nvidia-offload " else "";
terminal = "${prefix}ghostty";
explorer = "nautilus";
in
{
# ==== Disabled Services ==== #
services.swww.enable = mkForce false;
programs.waybar.enable = mkForce false;
services.swaync.enable = mkForce false;
home.packages = with pkgs; [
nerd-fonts.jetbrains-mono
];
fonts.fontconfig.enable = true;
# programs.niri.settings = with config.lib.niri.actions; {
# binds = {
# "Alt+Space".action = mkForce (spawn "caelestia" "shell" "drawers" "toggle" "launcher");
# };
# };
programs.caelestia = {
enable = true;
systemd.environment = [
"QT_QPA_PLATFORMTHEME=gtk3"
];
settings = {
paths.wallpaperDir = "~/Pictures/Wallpapers";
general.apps = {
terminal = [ terminal ];
explorer = [ explorer ];
};
visualiser.enabled = true;
osd.hideDelay = 1500;
utilities.vpn = {
enabled = hasAttr "wg-quick-wg0" osConfig.systemd.services;
provider = [
{
name = "wireguard";
interface = "wg0";
displayName = "Wireguard (DN)";
}
];
};
};
cli = {
enable = true;
settings = {
};
};
};
gtk = {
enable = true;
iconTheme = mkForce {
name = "Papirus-Dark";
package = pkgs.papirus-icon-theme;
};
};
}

View file

@ -1,10 +1,8 @@
{ ... }:
{
dconf.settings = {
"org/virt-manager/virt-manager/connections" = {
autoconnect = [ "qemu:///system" ];
uris = [ "qemu:///system" ];
};
dconf.settings."org/virt-manager/virt-manager/connections" = {
autoconnect = [ "qemu:///system" ];
uris = [ "qemu:///system" ];
};
# default network can be start with:

View file

@ -1,5 +1,6 @@
{
settings ? [ ],
matchByDesc ? false,
}:
{
osConfig,
@ -11,7 +12,15 @@
}:
let
inherit (helper) mkToggleScript;
inherit (lib) optionalString;
inherit (lib)
optionalString
imap0
getExe
concatStringsSep
map
;
wmName = if osConfig.programs.hyprland.enable then "hyprland" else "niri";
gamemodeToggle = mkToggleScript {
service = "gamemodedr";
@ -77,6 +86,35 @@ let
rbwSelector = import ../scripts/rbwSelector.nix { inherit pkgs; };
toggleRecord = pkgs.callPackage ../scripts/record.nix { };
includePath = "${config.home.homeDirectory}/.config/waybar";
mkMatchByDesc =
settings:
let
# Config will generated by systemd
descs = map (v: "${v.output}") settings;
descString = concatStringsSep ";" descs;
in
(pkgs.writeShellScript "config-match-by-desc" ''
FILE_PATH="${includePath}"
IFS=";" read -r -a DESCS <<< "${descString}"
monitors_json=$(${getExe pkgs.wlr-randr} --json)
i=0
for desc in "''\${DESCS[@]}"; do
name=$(${getExe pkgs.jq} -r --arg d "$desc" '
.[] | select((.make + " " + .model + " " + .serial) == $d) | .name
' <<< "$monitors_json")
file="monitor-$i.json"
printf '{ "output": "%s" }\n' "$name" > "$FILE_PATH/$file"
echo "$file Generated."
i=$((i+1))
done
'');
in
{
home.packages = [
@ -97,6 +135,14 @@ in
PartOf = [ "graphical-session.target" ];
After = [ "graphical-session.target" ];
};
Service.ExecStartPre =
let
matchScript = mkMatchByDesc settings;
in
[
"${matchScript}"
];
};
programs.waybar =
@ -264,63 +310,27 @@ in
margin-bottom = 0;
modules-center = [
"hyprland/window"
"${wmName}/window"
];
};
modulesConfig =
let
terminalRun = "${config.programs.ghostty.package}/bin/ghostty -e";
in
{
"hyprland/workspaces" = {
active-only = false;
commonWorkspace = {
all-outputs = true;
format = "{icon}";
show-special = false;
on-click = "activate";
on-scroll-up = "hyprctl dispatch workspace e+1";
on-scroll-down = "hyprctl dispatch workspace e-1";
persistent-workspaces = {
"1" = [ ];
"2" = [ ];
"3" = [ ];
"4" = [ ];
};
format-icons = {
active = "";
default = "";
};
};
clock = {
format = "<b>󰥔 {:%H:%M 󰃭 %d/%m}</b>";
tooltip-format = "{:%A %d %B %Y}";
};
actions = {
on-click-right = "mode";
on-click-forward = "tz_up";
on-click-backward = "tz_down";
on-scroll-up = "shift_up";
on-scroll-down = "shift_down";
};
"custom/os" = {
format = "󱄅";
on-click = "wlogout --protocol layer-shell";
};
cpu = {
format = " {usage}%";
max-length = 20;
interval = 5;
on-click-right = "${terminalRun} btop";
};
"hyprland/window" = {
commonWindow = {
format = "{}";
max-length = 40;
separate-outputs = true;
offscreen-css = true;
offscreen-css-text = "(inactive)";
rewrite = {
"nvim . (.*)" = " $1";
"(.*) \\| nvim (.*)" = " $1";
"(.*) \\| vi (.*)" = " $1";
"(.*) - Visual Studio Code" = " $1";
"\\(\\d+\\) Discord (.*)" = " $1";
@ -344,6 +354,60 @@ in
"(.*) - VLC media player" = " $1";
};
};
in
{
# ==== Niri ==== #
"niri/workspaces" = commonWorkspace // {
format-icons = {
focused = "";
game = "󰊗";
browser = "";
};
};
"niri/window" = commonWindow // {
};
# ==== Hyprland ==== #
"hyprland/workspaces" = commonWorkspace // {
active-only = false;
show-special = false;
on-click = "activate";
on-scroll-up = "hyprctl dispatch workspace e+1";
on-scroll-down = "hyprctl dispatch workspace e-1";
persistent-workspaces = {
"1" = [ ];
"2" = [ ];
"3" = [ ];
"4" = [ ];
};
};
"hyprland/window" = commonWindow // {
max-length = 40;
offscreen-css = true;
offscreen-css-text = "(inactive)";
};
clock = {
format = "<b>󰥔 {:%H:%M 󰃭 %d/%m}</b>";
tooltip-format = "{:%A %d %B %Y}";
};
actions = {
on-click-right = "mode";
on-click-forward = "tz_up";
on-click-backward = "tz_down";
on-scroll-up = "shift_up";
on-scroll-down = "shift_down";
};
"custom/os" = {
format = "󱄅";
on-click = "wlogout --protocol layer-shell";
};
cpu = {
format = " {usage}%";
max-length = 20;
interval = 5;
on-click-right = "${terminalRun} btop";
};
memory = {
interval = 30;
format = " {used:0.1f}GB/{total:0.1f}G";
@ -383,7 +447,7 @@ in
];
};
scroll-step = 5.0;
on-click = "pavucontrol -t 3";
on-click = "pwvucontrol -t 4";
tooltip-format = "{icon} {desc} | {volume}%";
smooth-scrolling-threshold = 1;
};
@ -455,6 +519,7 @@ in
"custom/cava" = {
exec = "${pkgs.writeShellScript "cava-wave" ''
#Taken from JaKoolit's dotfiles
PATH="$PATH:${pkgs.cava}/bin"
bar=""
dict="s/;//g"
@ -487,7 +552,7 @@ in
cava -p "$config_file" | sed -u "$dict"
''}";
format = "{}";
on-click = "${terminalRun} cava";
on-click = "${terminalRun} ${getExe pkgs.cava}";
};
battery =
let
@ -602,7 +667,7 @@ in
otherConfig = {
modules-left = [
"custom/os"
"hyprland/workspaces"
"${wmName}/workspaces"
"clock"
"mpris"
"custom/cava"
@ -622,7 +687,27 @@ in
];
};
finalList = if ((builtins.length settings) == 0) then [ otherConfig ] else settings;
finalList =
if ((builtins.length settings) == 0) then
# Use default configuration
[ otherConfig ]
else
(
if matchByDesc then
# Config will generated by systemd
(imap0 (
i: v:
let
outputRemoved = removeAttrs v [ "output" ];
includeAdded = outputRemoved // {
include = [ "${includePath}/monitor-${toString i}.json" ];
};
in
includeAdded
) settings)
else
settings
);
in
map (dev: dev // modulesConfig // commonConfig) finalList;

464
home/user/wm-service.nix Normal file
View file

@ -0,0 +1,464 @@
{
osConfig,
inputs,
pkgs,
config,
lib,
...
}:
let
inherit (lib) escapeShellArgs mkForce getExe';
inherit (osConfig.systemConf) username;
inherit (pkgs.stdenv.hostPlatform) system;
getCurrentSong = pkgs.writeShellScript "getSong" ''
song_info=$(playerctl metadata --format '{{title}} 󰎆 {{artist}}')
echo "$song_info"
'';
in
{
home.sessionVariables = {
NIXOS_OZONE_WL = "1";
GDK_BACKEND = "wayland";
QT_SCALE_FACTOR = "1";
QT_QPA_PLATFORM = "wayland";
QT_WAYLAND_DISABLE_WINDOWDECORATION = "1";
QT_AUTO_SCREEN_SCALE_FACTOR = "1";
QT_IM_MODULES = "wayland;fcitx;ibus";
MOZ_ENABLE_WAYLAND = "1";
SDL_VIDEODRIVER = "wayland";
WLR_NO_HARDWARE_CURSORS = "1";
CLUTTER_BACKEND = "wayland";
EGL_PLATFORM = "wayland";
XDG_SESSION_TYPE = "wayland";
};
home.packages = with pkgs; [
mpvpaper # Video Wallpaper
libnotify
sunsetr
wlogout
wl-clipboard
# Util
grim
slurp
];
systemd.user.tmpfiles.rules = [
"d ${config.home.homeDirectory}/Pictures/Wallpapers 0744 ${username} users -"
];
# === kanshi (Monitor Manager) === #
services.kanshi.enable = true;
# === Awww === #
services.swww = {
enable = true;
package = inputs.awww.packages.${system}.awww;
};
systemd.user.services.swww.Service.ExecStart =
mkForce "${getExe' config.services.swww.package "awww-daemon"} ${escapeShellArgs config.services.swww.extraArgs}";
# === sunsetr === #
services.sunsetr.enable = true;
# === swaync === #
services.swaync = {
enable = true;
package = (
pkgs.swaynotificationcenter.overrideAttrs (prev: rec {
version = "0.12.1";
buildInputs =
prev.buildInputs
++ (with pkgs; [
libhandy
pantheon.granite
gtk-layer-shell
]);
src = pkgs.fetchFromGitHub {
owner = "ErikReider";
repo = "SwayNotificationCenter";
rev = "v${version}";
hash = "sha256-kRawYbBLVx0ie4t7tChkA8QJShS83fUcGrJSKkxBy8Q=";
};
})
);
settings = {
control-center-height = 900;
control-center-margin-bottom = 20;
control-center-margin-left = 20;
control-center-margin-right = 20;
control-center-margin-top = 20;
control-center-width = 500;
fit-to-screen = true;
hide-on-action = true;
hide-on-clear = true;
image-visibility = "when-available";
keyboard-shortcuts = true;
layer = "overlay";
notification-body-image-height = 100;
notification-body-image-width = 200;
notification-icon-size = 64;
notification-window-width = 490;
positionX = "right";
positionY = "top";
script-fail-notify = true;
timeout = 3;
timeout-critical = 0;
timeout-low = 2;
transition-time = 200;
widgets = lib.mkForce [
"title"
"notifications"
"mpris"
];
};
style = # css
''
@define-color bgc rgba(0, 0, 0, 0.1);
@define-color borderc #ebdbb2;
@define-color textc #212121;
* {
font-family: ${osConfig.stylix.fonts.sansSerif.name};
font-size: ${toString osConfig.stylix.fonts.sizes.desktop}px;
font-weight: bold;
border-width: 3px;
border-color: #ebdbb2;
}
.control-center .notification-row:focus,
.control-center .notification-row:hover {
opacity: 1;
background: @bgc;
}
.notification-row {
outline: none;
margin: 5px;
padding: 0;
}
.notification {
background: @bgc;
margin: 0px;
border-radius: 6px;
border-width: 3px;
border-color: @borderc;
}
.notification-content {
background: @bgc;
padding: 7px;
margin: 0;
}
.close-button {
background: @bgc;
color: @borderc;
text-shadow: none;
padding: 0;
border-radius: 20px;
margin-top: 9px;
margin-right: 5px;
}
.close-button:hover {
box-shadow: none;
background: @borderc;
color: @textc;
transition: all .15s ease-in-out;
border: none;
}
.notification-action {
color: @borderc;
background: @bgc;
}
.notification-action:hover {
color: @textc;
background: @borderc;
}
.summary {
padding-top: 7px;
font-size: 13px;
color: @borderc;
}
.time {
font-size: 11px;
color: @borderc;
margin-right: 40px;
}
.body {
font-size: 12px;
color: @borderc;
}
.control-center {
background-color: @bgc;
border-radius: 20px;
}
.control-center-list {
background: transparent;
}
.control-center-list-placeholder {
opacity: .5;
}
.floating-notifications {
background: transparent;
}
.blank-window {
background: alpha(black, 0.1);
}
.widget-title {
color: @borderc;
padding: 10px 10px;
margin: 10px 10px 5px 10px;
font-size: 1.5rem;
}
.widget-title>button {
font-size: 1rem;
color: @borderc;
padding: 10px;
text-shadow: none;
background: @bgc;
box-shadow: none;
border-radius: 5px;
}
.widget-title>button:hover {
background: @borderc;
color: @textc;
}
.widget-label {
margin: 10px 10px 10px 10px;
}
.widget-label>label {
font-size: 1rem;
color: @borderc;
}
.widget-mpris {
color: @borderc;
padding: 5px 5px 5px 5px;
margin: 10px;
border-radius: 20px;
}
.widget-mpris>box>button {
border-radius: 20px;
}
.widget-mpris-player {
padding: 5px 5px;
margin: 10px;
}
'';
};
# === rofi === #
programs.rofi = {
enable = true;
package = pkgs.rofi;
plugins = with pkgs; [
rofi-emoji
rofi-calc
];
};
# === hyprlock === #
programs.hyprlock = {
enable = true;
importantPrefixes = [
"$"
"monitor"
"size"
"source"
];
settings =
let
font = "CaskaydiaCove Nerd Font";
font2 = "SF Pro Display Bold";
in
{
background = [
{
path = "screenshot";
blur_passes = 3;
blur_size = 8;
contrast = 0.8916;
brightness = 0.8172;
vibrancy = 0.1696;
vibrancy_darkness = 0.0;
}
];
animations = {
enabled = true;
fade_in = {
duration = 300;
bezier = "easeeOutQuint";
};
fade_out = {
duration = 300;
bezier = "easeeOutQuint";
};
};
# GENERAL
general = {
no_fade_in = false;
grace = 0;
disable_loading_bar = false;
ignore_empty_input = true;
fail_timeout = 1000;
};
# TIME
label = [
{
text = ''cmd[update:1000] echo "$(date +"%-I:%M%p")"'';
color = "rgba(250, 189, 47, .75)";
font_size = 120;
font_family = "${font2}";
position = "0, -140";
halign = "center";
valign = "top";
}
# DAY-DATE-MONTH
{
text = ''cmd[update:1000] echo "<span>$(date '+%A, %d %B')</span>"'';
color = "rgba(225, 225, 225, 0.75)";
font_size = 30;
font_family = "${font2}";
position = "0, 200";
halign = "center";
valign = "center";
}
# USER
{
text = "Hello, $USER";
color = "rgba(255, 255, 255, .65)";
font_size = 25;
font_family = "${font2}";
position = "0, -70";
halign = "center";
valign = "center";
}
# Current Song
{
text = ''cmd[update:1000] echo "$(${getCurrentSong})"'';
color = "rgba(235, 219, 178, .75)";
font_size = 16;
font_family = "${font}, ${font2}";
position = "0, 80";
halign = "center";
valign = "bottom";
}
];
# LOGO
image = {
path = "$HOME/.face";
border_size = 2;
border_color = "rgba(255, 255, 255, .75)";
size = 95;
rounding = -1;
rotate = 0;
reload_time = -1;
reload_cmd = "";
position = "0, 60";
halign = "center";
valign = "center";
};
# INPUT FIELD
input-field = [
{
size = "290, 60";
outline_thickness = 2;
dots_size = 0.2; # Scale of input-field height, 0.2 - 0.8
dots_spacing = 0.2; # Scale of dots' absolute size, 0.0 - 1.0
dots_center = true;
outer_color = "rgba(0, 0, 0, 0)";
inner_color = "rgba(60, 56, 54, 0.35)";
font_color = "rgb(200, 200, 200)";
fail_color = "rgba(218, 53, 50, 0.56)";
fade_on_empty = false;
font_family = "${font2}";
placeholder_text = ''<i><span foreground="##ffffff99">Bruh, come back!</span></i>'';
hide_input = false;
position = "0, -140";
halign = "center";
valign = "center";
}
];
};
};
# === hypridle === #
services.hypridle = {
enable = true;
settings = {
general = {
lock_cmd = "pidof hyprlock || hyprlock";
before_sleep_cmd = "loginctl lock-session";
after_sleep_cmd = "niri msg power-off-monitors";
ignore_dbus_inhibit = false;
ignore_systemd_inhibit = false;
};
listener = [
# 2.5min -> set monitor backlight to minimum
{
timeout = 150;
on-timeout = "brightnessctl -s set 10";
on-resume = "brightnessctl -r";
}
# 2.5min -> turn off keyboard backlight
{
timeout = 150;
on-timeout = "brightnessctl -sd rgb:kbd_backlight set 0";
on-resume = "brightnessctl -rd rgb:kbd_backlight";
}
# 5min -> Lock screen
{
timeout = 300;
on-timeout = "loginctl lock-session";
}
# 5.5min -> Screen off
{
timeout = 330;
on-timeout = "niri msg power-off-monitors";
on-resume = "niri msg power-on-monitors";
}
# 30min -> Suspend pc
# {
# timeout = 1800;
# on-timeout = "systemctl suspend";
# }
];
};
};
}

View file

@ -7,6 +7,7 @@
}:
let
inherit (pkgs.stdenv.hostPlatform) system;
inherit (lib) getExe';
yaziPlugins = pkgs.fetchFromGitHub {
owner = "yazi-rs";
repo = "plugins";
@ -19,10 +20,7 @@ let
for path in "$@"; do
output_path="normalized_$(basename "$path")"
${pkgs.ghostscript}/bin/gs \
-o "$output_path" \
-sDEVICE=pdfwrite \
-sPAPERSIZE=a4 \
-dFIXEDMEDIA \
-o "$output_path" \ -sDEVICE=pdfwrite \ -sPAPERSIZE=a4 \ -dFIXEDMEDIA \
-dPDFFitPage "$path"
done
'';
@ -30,210 +28,214 @@ let
pdfCombine = pkgs.writeShellScriptBin "combine-pdf" ''
${lib.getExe pkgs.pdftk} "$@" cat output combined_$(date +%Y%m%d_%H%M%S).pdf
'';
setWallpaper =
if config.services.swww.enable then
''shell -- ${getExe' config.services.swww.package "awww"} img "$0" --transition-fps 45 --transition-duration 1 --transition-type random''
else
''shell '${getExe' config.programs.caelestia.cli.package "caelestia"} wallpaper -f "$0" 2>&1 >/dev/null' '';
in
{
programs = {
yazi = {
enable = true;
package = inputs.yazi.packages.${system}.default;
shellWrapperName = "y";
enableFishIntegration = true;
programs.yazi = {
enable = true;
package = inputs.yazi.packages.${system}.default;
shellWrapperName = "y";
enableFishIntegration = true;
plugins = {
toggle-pane = ''${yaziPlugins}/toggle-pane.yazi'';
mount = ''${yaziPlugins}/mount.yazi'';
zoom = ''${yaziPlugins}/zoom'';
vcs-files = ''${yaziPlugins}/vcs-files'';
git = ''${yaziPlugins}/git'';
};
settings = {
plugin.prepend_fetchers = [
{
id = "git";
name = "*";
run = "git";
}
];
input = {
cursor_blink = true;
};
opener = {
edit = [
{
run = ''''\${EDITOR:=nvim} "$0"'';
desc = "$EDITOR";
block = true;
}
{
run = ''code "$0"'';
orphan = true;
}
];
player = [
{ run = ''mpv --force-window "$0"''; }
];
open = [
{
run = ''xdg-open "$0"'';
desc = "Open";
}
];
};
open = {
prepend_rules = [
{
mime = "application/pdf";
use = "open";
}
];
};
};
keymap = {
mgr.prepend_keymap = [
# Set Wallpaper
{
on = [
"g"
"w"
];
run = ''shell -- ${config.services.swww.package}/bin/awww img "$0" --transition-fps 45 --transition-duration 1 --transition-type random'';
desc = "Set as wallpaper";
}
# Git Changes
{
on = [
"g"
"c"
];
run = "plugin vcs-files";
desc = "Show Git file changes";
}
# Image zoom
{
on = "+";
run = "plugin zoom 1";
desc = "Zoom in hovered file";
}
{
on = "-";
run = "plugin zoom -1";
desc = "Zoom out hovered file";
}
# Mount Manager
{
on = "M";
run = "plugin mount";
desc = "Launch mount manager";
# Usage
# Key binding Alternate key Action
# q - Quit the plugin
# k ↑ Move up
# j ↓ Move down
# l → Enter the mount point
# m - Mount the partition
# u - Unmount the partition
# e - Eject the disk
}
# Toggle Maximize Preview
{
on = "T";
run = "plugin toggle-pane max-preview";
desc = "Show or hide the preview panel";
}
# Copy selected files to the system clipboard while yanking
{
on = "y";
run = [
''shell -- for path in "$0" "$@"; do echo "file://$path"; done | wl-copy -t text/uri-list''
"yank"
];
}
# cd back to the root of the current Git repository
{
on = [
"g"
"r"
];
run = ''shell -- ya emit cd "$(git rev-parse --show-toplevel)"'';
desc = "Go to git root";
}
# Drag and Drop
{
on = [
"c"
"D"
];
run = ''shell 'ripdrag "$0" "$@" -x 2>/dev/null &' --confirm'';
desc = "Drag the file";
}
# Start terminal
{
on = [ "!" ];
for = "unix";
run = ''shell "$SHELL" --block'';
desc = "Open $SHELL here";
}
# Combine PDF
{
on = [
"F" # file
"p" # pdf
"c" # combine
];
for = "unix";
run = ''shell -- ${lib.getExe pdfCombine} "$0" "$@"'';
desc = "Combine selected pdf";
}
{
on = [
"F" # file
"p" # pdf
"n" # normalize
];
for = "unix";
run = ''shell -- ${lib.getExe pdfNormalize} "$0" "$@" 2>/dev/null'';
desc = "Normalize PDF to A4 size";
}
{
on = [
"F" # file
"H" # html
];
for = "unix";
run = [
''shell -- for path in "$0" "$@"; do ${lib.getExe md2html} "$path"; done''
];
desc = "Convert Markdown to HTML";
}
];
};
initLua =
# lua
''
-- Show user/group of files in status bar
Status:children_add(function()
local h = cx.active.current.hovered
if not h or ya.target_family() ~= "unix" then
return ""
end
return ui.Line {
ui.Span(ya.user_name(h.cha.uid) or tostring(h.cha.uid)):fg("magenta"),
":",
ui.Span(ya.group_name(h.cha.gid) or tostring(h.cha.gid)):fg("magenta"),
" ",
}
end, 500, Status.RIGHT)
'';
plugins = {
toggle-pane = ''${yaziPlugins}/toggle-pane.yazi'';
mount = ''${yaziPlugins}/mount.yazi'';
zoom = ''${yaziPlugins}/zoom'';
vcs-files = ''${yaziPlugins}/vcs-files'';
git = ''${yaziPlugins}/git'';
};
settings = {
plugin.prepend_fetchers = [
{
id = "git";
name = "*";
run = "git";
}
];
input = {
cursor_blink = true;
};
opener = {
edit = [
{
run = ''''\${EDITOR:=nvim} "$0"'';
desc = "$EDITOR";
block = true;
}
{
run = ''code "$0"'';
orphan = true;
}
];
player = [
{ run = ''mpv --force-window "$0"''; }
];
open = [
{
run = ''xdg-open "$0"'';
desc = "Open";
}
];
};
open = {
prepend_rules = [
{
mime = "application/pdf";
use = "open";
}
];
};
};
keymap = {
mgr.prepend_keymap = [
# Set Wallpaper
{
on = [
"g"
"w"
];
run = setWallpaper;
desc = "Set as wallpaper";
}
# Git Changes
{
on = [
"g"
"c"
];
run = "plugin vcs-files";
desc = "Show Git file changes";
}
# Image zoom
{
on = "+";
run = "plugin zoom 1";
desc = "Zoom in hovered file";
}
{
on = "-";
run = "plugin zoom -1";
desc = "Zoom out hovered file";
}
# Mount Manager
{
on = "M";
run = "plugin mount";
desc = "Launch mount manager";
# Usage
# Key binding Alternate key Action
# q - Quit the plugin
# k ↑ Move up
# j ↓ Move down
# l → Enter the mount point
# m - Mount the partition
# u - Unmount the partition
# e - Eject the disk
}
# Toggle Maximize Preview
{
on = "T";
run = "plugin toggle-pane max-preview";
desc = "Show or hide the preview panel";
}
# Copy selected files to the system clipboard while yanking
{
on = "y";
run = [
''shell -- for path in "$@"; do echo "file://$path"; done | wl-copy -t text/uri-list''
"yank"
];
}
# cd back to the root of the current Git repository
{
on = [
"g"
"r"
];
run = ''shell -- ya emit cd "$(git rev-parse --show-toplevel)"'';
desc = "Go to git root";
}
# Drag and Drop
{
on = [
"c"
"D"
];
run = ''shell 'ripdrag "$@" -x 2>/dev/null &' --confirm'';
desc = "Drag the file";
}
# Start terminal
{
on = [ "!" ];
for = "unix";
run = ''shell "$SHELL" --block'';
desc = "Open $SHELL here";
}
# Combine PDF
{
on = [
"F" # file
"p" # pdf
"c" # combine
];
for = "unix";
run = ''shell -- ${lib.getExe pdfCombine} "$@"'';
desc = "Combine selected pdf";
}
{
on = [
"F" # file
"p" # pdf
"n" # normalize
];
for = "unix";
run = ''shell -- ${lib.getExe pdfNormalize} "$@" 2>/dev/null'';
desc = "Normalize PDF to A4 size";
}
{
on = [
"F" # file
"H" # html
];
for = "unix";
run = [
''shell -- for path in "$@"; do ${lib.getExe md2html} "$path"; done''
];
desc = "Convert Markdown to HTML";
}
];
};
initLua =
# lua
''
-- Show user/group of files in status bar
Status:children_add(function()
local h = cx.active.current.hovered
if not h or ya.target_family() ~= "unix" then
return ""
end
return ui.Line {
ui.Span(ya.user_name(h.cha.uid) or tostring(h.cha.uid)):fg("magenta"),
":",
ui.Span(ya.group_name(h.cha.gid) or tostring(h.cha.gid)):fg("magenta"),
" ",
}
end, 500, Status.RIGHT)
'';
};
home.packages = with pkgs; [

View file

@ -21,7 +21,7 @@ let
zellij-sessionizer-src = fetchurl {
url = "https://raw.githubusercontent.com/dachxy/zellij-sessionizer/refs/heads/main/zellij-sessionizer";
sha256 = "sha256:01az9blb86mc3lxaxnrfcj23jaxhagsbs31qjn6pj5wm1wgb2mrf";
sha256 = "sha256:12kbni75x9g424bymky8cy84i354j654rfmz9bffnabbblccfbpn";
};
zellij-sessionizer = pkgs.writeShellScriptBin "zellij-sessionizer" ''
@ -29,6 +29,7 @@ let
export ZELLIJ_SESSIONIZER_SEARCH_PATHS="$HOME/projects $HOME/notes $HOME/expr"
export ZELLIJ_SESSIONIZER_SPECIFIC_PATHS="/etc/nixos"
export ZELLIJ_SESSIONIZER_SWITCH_PLUGIN="file:${zellij-switch}"
export ZELLIJ_SESSIONIZER_SWITCH_PLUGIN_EXTRA_COMMAND="--layout ${config.programs.zellij.settings.default_layout}"
bash ${zellij-sessionizer-src}
'';
@ -40,15 +41,15 @@ in
programs.fish.shellAliases = {
al = "zellij";
aa = "zellij a --index 0";
aa = "zellij a --index 0 || cd /etc/nixos && zellij -s nixos";
zs = "zellij-sessionizer";
};
programs.zellij = {
enable = true;
attachExistingSession = true;
enableFishIntegration = true;
enableBashIntegration = true;
attachExistingSession = false;
enableFishIntegration = false;
enableBashIntegration = false;
settings = {
pane_frames = false;
@ -208,7 +209,7 @@ in
bind "Esc" { UndoRenamePane; SwitchToMode "Pane"; }
}
session {
bind "Ctrl o" "Ctrl c" { SwitchToMode "Normal"; }
bind "Ctrl shift o" "Ctrl c" { SwitchToMode "Normal"; }
bind "Ctrl s" { SwitchToMode "Scroll"; }
bind "d" { Detach; }
bind "w" {

View file

@ -1,59 +1,183 @@
{
pkgs,
osConfig,
config,
helper,
pkgs,
...
}:
let
inherit (osConfig.systemConf) username;
inherit (helper) capitalize;
inherit (pkgs) runCommand;
zenNebula = pkgs.fetchFromGitHub {
owner = "justadumbprsn";
owner = "JustAdumbPrsn";
repo = "zen-nebula";
rev = "main";
sha256 = "sha256-f4J5ob/apKhxERUSvXE8QHMMsKJCQFRoMSo/Pw4LgTg=";
sha256 = "sha256-wtntRAkOGm6fr396kqzqk+GyPk+ytifXTqqOp0YIvlw=";
};
profileName = capitalize username;
patchedNebula =
runCommand "patched-nebula"
{
src = zenNebula;
buildInputs = with pkgs; [
rsync
coreutils
];
}
# Fix for nebula without `sine`
''
mkdir -p $out/Nebula
tail -n +28 $src/Nebula/Nebula-config.css > $out/Nebula/Nebula-config.css
rsync -av --exclude "Nebula-config.css" $src/ $out/
'';
profileName = "${capitalize username} Profile";
in
{
programs.zen-browser = {
enable = true;
languagePacks = [
"en-US"
"zh-Tw"
];
policies = {
AutofillAddressEnabled = true;
AutofillCreditCardEnabled = false;
DisableAppUpdate = true;
DisableFeedbackCommands = true;
DisableFirefoxStudies = true;
DisablePocket = true;
DisableTelemetry = true;
DontCheckDefaultBrowser = true;
NoDefaultBookmarks = true;
OfferToSaveLogins = false;
EnableTrackingProtection = {
Value = true;
Locked = true;
Cryptomining = true;
Fingerprinting = true;
};
Certificates.Install = [
../../system/extra/ca.crt
];
Preferences = {
"browser.aboutConfig.showWarning" = false;
"browser.shell.checkDefaultBrowser" = false;
"browser.shell.didSkipDefaultBrowserCheckOnFirstRun" = true;
"browser.tabs.allow_transparent_browser" = true;
"toolkit.legacyUserProfileCustomizations.stylesheets" = true;
"font.language.group" = "zh-TW";
"font.name.sans-serif.ja" = "Noto Sans CJK JP";
"font.name.sans-serif.zh-TW" = "Noto Sans CJK TC";
"font.name.serif.ja" = "Noto Serif CJK JP";
"font.name.serif.zh-TW" = "Noto Serif CJK TC";
"font.name.monospace.ja" = "Noto Sans Mono CJK JP";
"font.name.monospace.x-western" = "CaskaydiaCove Nerd Font Mono";
"font.name.monospace.zh-TW" = "Noto Sans Mono CJK TC";
};
ExtensionSettings =
let
mkExtensionSettings = builtins.mapAttrs (
_: pluginId: {
install_url = "https://addons.mozilla.org/firefox/downloads/latest/${pluginId}/latest.xpi";
installation_mode = "force_installed";
}
);
in
(mkExtensionSettings {
"{446900e4-71c2-419f-a6a7-df9c091e268b}" = "bitwarden-password-manager";
"{4f391a9e-8717-4ba6-a5b1-488a34931fcb}" = "bonjourr-startpage";
"addon@darkreader.org" = "darkreader";
"firefox@ghostery.com" = "ghostery";
"{7a7a4a92-a2a0-41d1-9fd7-1e92480d612d}" = "styl-us";
"firefox@tampermonkey.net" = "tampermonkey";
"user-agent-switcher@ninetailed.ninja" = "uaswitcher";
"{d7742d87-e61d-4b78-b8a1-b469842139fa}" = "vimium-ff";
"{91aa3897-2634-4a8a-9092-279db23a7689}" = "zen-internet";
})
// {
"moz-addon-prod@7tv.app" = {
install_url = "https://extension.7tv.gg/v3.1.13/ext.xpi";
installation_mode = "force_installed";
};
};
};
profiles = {
"${profileName} Profile" = {
default = true;
"${profileName}" = {
isDefault = true;
name = username;
search.default = "google";
search.privateDefault = "ddg";
settings = {
"zen.view.compact.should-enable-at-startup" = true;
"zen.widget.linux.transparency" = true;
"zen.view.compact.show-sidebar-and-toolbar-on-hover" = false;
"zen.tabs.vertical.right-side" = true;
"zen.urlbar.behavior" = "float";
# Nebula
"nebula-tab-loading-animation" = 0;
"nebula-essentials-gray-icons" = false;
"nebula-compact-mode-no-sidebar-bg" = true;
"nebula-disable-container-styling" = true;
"app.update.auto" = false;
"app.normandy.first_run" = false;
"browser.aboutConfig.showWarning" = false;
"browser.shell.checkDefaultBrowser" = false;
"browser.shell.didSkipDefaultBrowserCheckOnFirstRun" = true;
"browser.tabs.allow_transparent_browser" = true;
"browser.urlbar.placeholderName" = "Google";
"browser.urlbar.placeholderName.private" = "DuckDuckGo";
"middlemouse.paste" = false;
"toolkit.legacyUserProfileCustomizations.stylesheets" = true;
"font.language.group" = "zh-TW";
"font.name.sans-serif.ja" = "Noto Sans CJK JP";
"font.name.sans-serif.zh-TW" = "Noto Sans CJK TC";
"font.name.serif.ja" = "Noto Serif CJK JP";
"font.name.serif.zh-TW" = "Noto Serif CJK TC";
"font.name.monospace.ja" = "Noto Sans Mono CJK JP";
"font.name.monospace.x-western" = "CaskaydiaCove Nerd Font Mono";
"font.name.monospace.zh-TW" = "Noto Sans Mono CJK TC";
};
ensureCACertifications = [
../../system/extra/ca.crt
];
chrome = zenNebula;
};
};
};
home.file.".zen/${profileName}/zen-keyboard-shortcuts.json".source =
../config/zen/zen-keyboard-shortcuts.json;
home.file.".zen/${profileName}/chrome" = {
source = patchedNebula;
recursive = true;
};
xdg.mimeApps =
let
value =
let
zen-browser = config.programs.zen-browser.package;
in
zen-browser.meta.desktopFileName;
associations = builtins.listToAttrs (
map
(name: {
inherit name value;
})
[
"application/x-extension-shtml"
"application/x-extension-xhtml"
"application/x-extension-html"
"application/x-extension-xht"
"application/x-extension-htm"
"x-scheme-handler/unknown"
"x-scheme-handler/mailto"
"x-scheme-handler/chrome"
"x-scheme-handler/about"
"x-scheme-handler/https"
"x-scheme-handler/http"
"application/xhtml+xml"
"application/json"
"application/pdf"
"text/plain"
"text/html"
]
);
in
{
associations.added = associations;
defaultApplications = associations;
};
}