diff --git a/pkgs/by-name/gu/gui-for-clash/package.nix b/pkgs/by-name/gu/gui-for-clash/package.nix index 2c707e31d51b..5e441adb5833 100644 --- a/pkgs/by-name/gu/gui-for-clash/package.nix +++ b/pkgs/by-name/gu/gui-for-clash/package.nix @@ -18,13 +18,13 @@ let pname = "gui-for-clash"; - version = "1.11.0"; + version = "1.16.0"; src = fetchFromGitHub { owner = "GUI-for-Cores"; repo = "GUI.for.Clash"; tag = "v${version}"; - hash = "sha256-kk6ZjG58gMIPd8f3Ib+1z7bie9X5kJvBq/CwioksbcU="; + hash = "sha256-eIKgXZ48iVkFSwTJ04j6CXyvgVsUCBRZ9hwdid/DwsE="; }; metaCommon = { @@ -54,7 +54,7 @@ let ; pnpm = pnpm_10; fetcherVersion = 2; - hash = "sha256-MvGLIB68itkCGsBIgAI6ak5xa5rFAJfoAwNuISPRw30="; + hash = "sha256-oi78tk0ygR37jtWW3hZnDF44qxWjIFvUU4u5rNffvD8="; }; buildPhase = '' @@ -84,13 +84,7 @@ buildGoModule { patches = [ ./xdg-path-and-restart-patch.patch ]; - # As we need the $out reference, we can't use `replaceVars` here. - postPatch = '' - substituteInPlace bridge/bridge.go \ - --subst-var out - ''; - - vendorHash = "sha256-6T9cFVzfRJnwnWjc61oSihifgnP81n3K+jlLHXGmA4I="; + vendorHash = "sha256-ElDJknPzR7Zh46RjUsn39Msm1B8Nsp1eHIS3ifRl80w="; nativeBuildInputs = [ autoPatchelfHook diff --git a/pkgs/by-name/gu/gui-for-clash/xdg-path-and-restart-patch.patch b/pkgs/by-name/gu/gui-for-clash/xdg-path-and-restart-patch.patch index bc37666aaf5c..0d2c56ff5e9d 100644 --- a/pkgs/by-name/gu/gui-for-clash/xdg-path-and-restart-patch.patch +++ b/pkgs/by-name/gu/gui-for-clash/xdg-path-and-restart-patch.patch @@ -1,31 +1,32 @@ --- a/bridge/bridge.go +++ b/bridge/bridge.go -@@ -41,13 +41,13 @@ - } - - func CreateApp(fs embed.FS) *App { -- exePath, err := os.Executable() -- if err != nil { -- panic(err) -+ Env.AppName = "GUI.for.Clash" -+ xdgDataHome := os.Getenv("XDG_DATA_HOME") -+ if xdgDataHome == "" { -+ homeDir, _ := os.UserHomeDir() -+ xdgDataHome = filepath.Join(homeDir, ".local", "share") +@@ -55,9 +55,14 @@ + + app := NewApp() + +- if Env.OS == "darwin" { +- createMacOSSymlink() +- createMacOSMenus(app) ++ if Env.OS == "linux" || Env.OS == "darwin" { ++ userConfigDir, err := os.UserConfigDir() ++ if err == nil { ++ targetPath := filepath.Join(userConfigDir, Env.AppName) ++ if err := os.MkdirAll(targetPath, 0755); err == nil { ++ Env.BasePath = targetPath ++ } ++ } } -- -- Env.BasePath = filepath.Dir(exePath) -- Env.AppName = filepath.Base(exePath) -+ Env.BasePath = filepath.Join(xdgDataHome, Env.AppName) - - if slices.Contains(os.Args, "tasksch") { - Env.FromTaskSch = true -@@ -76,7 +76,7 @@ + + if Env.OS == "windows" { +@@ -80,7 +85,10 @@ } - + func (a *App) RestartApp() FlagResult { - exePath := Env.BasePath + "/" + Env.AppName -+ exePath := "@out@/bin" + "/" + Env.AppName - ++ exePath, err := os.Executable() ++ if err != nil { ++ exePath = filepath.Join(Env.BasePath, Env.AppName) ++ } + cmd := exec.Command(exePath) SetCmdWindowHidden(cmd)