From f637e50a7aa045e8b0d26a0a65f83c05d5998dd1 Mon Sep 17 00:00:00 2001 From: danny Date: Thu, 21 Aug 2025 23:13:15 +0800 Subject: [PATCH] refactor: remove files not need anymore --- home/user/desktops.nix | 69 ---------------------------------------- home/user/shellAlias.nix | 2 +- system/modules/tmux.nix | 6 ++-- utils/gpu-offload.nix | 19 ----------- utils/make-icon.nix | 51 ----------------------------- 5 files changed, 4 insertions(+), 143 deletions(-) delete mode 100644 utils/gpu-offload.nix delete mode 100644 utils/make-icon.nix diff --git a/home/user/desktops.nix b/home/user/desktops.nix index b851cd9..34f0c06 100644 --- a/home/user/desktops.nix +++ b/home/user/desktops.nix @@ -1,81 +1,12 @@ { lib, pkgs, - config, ... }: -let - browser = "firefox"; - iconPrefix = ".local/share/icons/hicolor/scalable/apps"; - newWindow = "${browser} --new-window"; - googleCalendarIcon = pkgs.callPackage (import ../../utils/make-icon.nix { - name = "google-calendar"; - url = "https://ssl.gstatic.com/calendar/images/dynamiclogo_2020q4/calendar_6_2x.png"; - sha256 = "sha256-IODUWX9m0iwunJWPJv1kw5gfgDPvAZtmD8vcSTEBjsQ="; - }) { }; -in { - home.packages = [ - googleCalendarIcon - ]; - - # UpdamkIconPkg te icon cache home.activation = { updateIconCache = lib.hm.dag.entryAfter [ "linkGeneration" ] '' $DRY_RUN_CMD ${pkgs.gtk3}/bin/gtk-update-icon-cache -t -f ~/.local/share/icons/hicolor ''; }; - - home.file = { - "${iconPrefix}/notion.svg".text = '' - - - - - - - - - - - - - - - - - - - - - - ''; - }; - - xdg.desktopEntries = { - notion = { - name = "Notion"; - genericName = "Note"; - exec = "${newWindow} https://notion.so"; - comment = "Note Take Application"; - icon = "${config.home.homeDirectory}/${iconPrefix}/notion.svg"; - terminal = false; - categories = [ - "Office" - "Utility" - ]; - }; - - google-calendar = { - name = "Google Calendar"; - genericName = "Calendar"; - exec = "${pkgs.xdg-utils}/bin/xdg-open https://calendar.google.com/u/2/r"; - comment = "Google Calendar"; - icon = "google-calendar"; - terminal = false; - categories = [ - "Office" - ]; - }; - }; } diff --git a/home/user/shellAlias.nix b/home/user/shellAlias.nix index e7bf03b..1a7816c 100644 --- a/home/user/shellAlias.nix +++ b/home/user/shellAlias.nix @@ -8,7 +8,7 @@ # Nixos rebuild = "sudo nixos-rebuild switch --flake /etc/nixos#${hostname}"; - fullClean = "sudo nix store gc && sudo /run/current-system/bin/switch-to-configuration boot"; + fullClean = "sudo nix store gc && sudo nix-collect-garbage -d && sudo /run/current-system/bin/switch-to-configuration boot"; # Hyprland hyprlog = "grep -v \"arranged\" $XDG_RUNTIME_DIR/hypr/$HYPRLAND_INSTANCE_SIGNATURE/hyprland.log | cat"; diff --git a/system/modules/tmux.nix b/system/modules/tmux.nix index 53b9205..1d94abd 100644 --- a/system/modules/tmux.nix +++ b/system/modules/tmux.nix @@ -1,7 +1,7 @@ { pkgs, config, ... }: let - getIconScript = pkgs.writeShellScriptBin "get-icon" ( + getIconScript = pkgs.writeShellScript "get-icon" ( builtins.readFile ../../home/config/scripts/getIcons.sh ); prefixKey = "C-Space"; @@ -48,8 +48,8 @@ in set -g status-left "#[fg=#84977f,bg=default,bold] █ session: #S" set -g status-right " #[fg=#828bb8,bg=default,bold]${config.networking.hostName}   " - setw -g window-status-format "#[fg=#171616,bg=default] #[fg=#495361,bg=default]#(${getIconScript}/get-icon #I) #W" - setw -g window-status-current-format "#[fg=#7e93a9,bg=default] #[fg=#7e93a9,bg=default,bold]#(${getIconScript}/get-icon #I) #W" + setw -g window-status-format "#[fg=#171616,bg=default] #[fg=#495361,bg=default]#(${getIconScript} #I) #W" + setw -g window-status-current-format "#[fg=#7e93a9,bg=default] #[fg=#7e93a9,bg=default,bold]#(${getIconScript} #I) #W" set -g default-terminal "xterm-256color" set -ga terminal-overrides ",*256col*:Tc" diff --git a/utils/gpu-offload.nix b/utils/gpu-offload.nix deleted file mode 100644 index 63947f3..0000000 --- a/utils/gpu-offload.nix +++ /dev/null @@ -1,19 +0,0 @@ -{ - pkgs, - lib, - ... -}: - -with pkgs; -let - patchDesktop = - pkg: appName: from: to: - lib.hiPrio ( - pkgs.runCommand "$patched-desktop-entry-for-${appName}" { } '' - ${coreutils}/bin/mkdir -p $out/share/applications - ${gnused}/bin/sed 's#${from}#${to}#g' < ${pkg}/share/applications/${appName}.desktop > $out/share/applications/${appName}.desktop - '' - ); - GPUOffloadApp = pkg: desktopName: patchDesktop pkg desktopName "^Exec=" "Exec=nvidia-offload "; -in -GPUOffloadApp diff --git a/utils/make-icon.nix b/utils/make-icon.nix deleted file mode 100644 index d4efc1b..0000000 --- a/utils/make-icon.nix +++ /dev/null @@ -1,51 +0,0 @@ -{ - name, - url, - sha256, -}: -{ - pkgs, - imagemagick, - file, - stdenvNoCC, - ... -}: -let - appName = name; -in -stdenvNoCC.mkDerivation rec { - pname = "${appName}-icon"; - name = pname; - - src = pkgs.fetchurl { - inherit url sha256; - }; - - dontUnpack = true; - - nativeBuildInputs = [ - imagemagick - file - ]; - - buildPhase = '' - mkdir -p $out/share/icons/hicolor/256x256/apps - mkdir -p $out/share/icons/hicolor/scalable/apps - - fileType=$(file -b --mime-type $src) - if [ "$fileType" = "image/png" ]; then - echo "Processing PNG image..." - magick $src -resize 256x256 $out/share/icons/hicolor/256x256/apps/${appName}.png - elif [ "$fileType" = "image/svg+xml" ]; then - echo "Processing SVG image..." - cp $src $out/share/icons/hicolor/scalable/apps/${appName}.svg - else - echo "Unsupported image type: $fileType" - exit 1 - fi - ''; - - pathsToLink = [ - "/share/icons" - ]; -}