Merge pull request #315610 from max-amb/nwg-look

nwg-look: 0.2.6 -> 0.2.7
This commit is contained in:
Pol Dellaiera 2024-05-30 20:01:25 +02:00 committed by GitHub
commit 1902da96e1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 18 additions and 50 deletions

View File

@ -1,7 +1,7 @@
{ lib
, stdenv
, fetchFromGitHub
, substituteAll
, wrapGAppsHook3
, buildGoModule
, go
, glib
@ -15,32 +15,26 @@
buildGoModule rec {
pname = "nwg-look";
version = "0.2.6";
version = "0.2.7";
src = fetchFromGitHub {
owner = "nwg-piotr";
repo = "nwg-look";
rev = "v${version}";
hash = "sha256-kOoYhJKt7/BsQ0/RuVhj0bWnX9GU8ET3MSq6NMCOw5E=";
hash = "sha256-qUNTJkNHWoJisLH0SU23UQuamEL27MMRnxw0kBxzWLk=";
};
vendorHash = "sha256-V0KXK6jxBYI+tixBLq24pJJcnu4gDF6nfyns2IBTss4=";
# Replace /usr/ directories with the packages output location
# This means it references the correct path
patches = [ ./fix-paths.patch ];
postPatch = ''
substituteInPlace main.go tools.go --replace '@out@' $out
'';
vendorHash = "sha256-qHWy9OCxENrrWk00YoRveSjqYWIy/fe4Fyc8tc4n34E=";
ldflags = [ "-s" "-w" ];
nativeBuildInputs = [
pkg-config
wrapGAppsHook3
];
buildInputs = [
glib
cairo
xcur2png
libX11.dev
@ -55,12 +49,21 @@ buildGoModule rec {
mkdir -p $out/share/nwg-look/langs
mkdir -p $out/share/applications
mkdir -p $out/share/pixmaps
mkdir -p $out/share/icons
cp stuff/main.glade $out/share/nwg-look/
cp langs/* $out/share/nwg-look/langs
cp stuff/nwg-look.desktop $out/share/applications
cp stuff/nwg-look.svg $out/share/pixmaps
'';
preFixup = ''
gappsWrapperArgs+=(
--prefix PATH : "${glib.bin}/bin"
--prefix PATH : "${xcur2png}/bin"
--prefix XDG_DATA_DIRS : "${gtk3}/share/gsettings-schemas/${gtk3.name}"
)
'';
meta = with lib; {
homepage = "https://github.com/nwg-piotr/nwg-look";
description = "Nwg-look is a GTK3 settings editor, designed to work properly in wlroots-based Wayland environment.";

View File

@ -1,35 +0,0 @@
diff --git a/main.go b/main.go
index 23c4756..c52e9c3 100644
--- a/main.go
+++ b/main.go
@@ -335,7 +335,7 @@ func main() {
gtkSettings, _ = gtk.SettingsGetDefault()
- builder, _ := gtk.BuilderNewFromFile("/usr/share/nwg-look/main.glade")
+ builder, _ := gtk.BuilderNewFromFile("@out@/share/nwg-look/main.glade")
win, _ := getWindow(builder, "window")
win.Connect("destroy", func() {
diff --git a/tools.go b/tools.go
index e6e7665..59d6f35 100644
--- a/tools.go
+++ b/tools.go
@@ -1034,7 +1034,7 @@ func getDataDirs() []string {
if os.Getenv("XDG_DATA_DIRS") != "" {
xdgDataDirs = os.Getenv("XDG_DATA_DIRS")
} else {
- xdgDataDirs = "/usr/local/share/:/usr/share/"
+ xdgDataDirs = "@out@/local/share/:@out@/share/"
}
for _, d := range strings.Split(xdgDataDirs, ":") {
@@ -1280,7 +1280,7 @@ func detectLang() string {
}
func loadVocabulary(lang string) map[string]string {
- langsDir := "/usr/share/nwg-look/langs/"
+ langsDir := "@out@/share/nwg-look/langs/"
enUSFile := filepath.Join(langsDir, "en_US.json")
if pathExists(enUSFile) {
log.Infof(">>> Loading basic lang from '%s'", enUSFile)

View File

@ -1,10 +1,10 @@
module github.com/nwg-piotr/nwg-look
go 1.20
go 1.22
require (
github.com/gotk3/gotk3 v0.6.2
github.com/gotk3/gotk3 v0.6.3
github.com/sirupsen/logrus v1.9.3
)
require golang.org/x/sys v0.6.0 // indirect
require golang.org/x/sys v0.17.0 // indirect