1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-18 19:51:17 +00:00

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

nwg-look: init at v0.2.4
This commit is contained in:
Pol Dellaiera 2023-09-09 11:21:36 +02:00 committed by GitHub
commit 9108a20782
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 120 additions and 1 deletions

View file

@ -10826,7 +10826,7 @@
}];
};
max-amb = {
email = "maxpeterambaum@gmail.com";
email = "max_a@e.email";
github = "max-amb";
githubId = 137820334;
name = "Max Ambaum";

View file

@ -0,0 +1,72 @@
{ lib
, stdenv
, fetchFromGitHub
, substituteAll
, buildGoModule
, go
, glib
, pkg-config
, cairo
, gtk3
, xcur2png
, libX11
, zlib
}:
buildGoModule rec {
pname = "nwg-look";
version = "0.2.4";
src = fetchFromGitHub {
owner = "nwg-piotr";
repo = pname;
rev = "v${version}";
hash = "sha256-wUI58qYkVYgES87HQ4octciDlOJ10oJldbUkFgxRUd4=";
};
vendorHash = "sha256-dev+TV6FITd29EfknwHDNI0gLao7gsC95Mg+3qQs93E=";
# 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
'';
ldflags = [ "-s" "-w" ];
nativeBuildInputs = [
pkg-config
];
buildInputs = [
cairo
xcur2png
libX11.dev
zlib
gtk3
];
CGO_ENABLED = 1;
postInstall = ''
mkdir -p $out/share
mkdir -p $out/share/nwg-look/langs
mkdir -p $out/share/applications
mkdir -p $out/share/pixmaps
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
'';
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.";
license = licenses.mit;
platforms = platforms.linux;
maintainers = with maintainers; [ max-amb ];
mainProgram = "nwg-look";
};
}

View file

@ -0,0 +1,35 @@
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

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

View file

@ -34271,6 +34271,8 @@ with pkgs;
nwg-launchers = callPackage ../applications/misc/nwg-launchers { };
nwg-look = callPackage ../applications/misc/nwg-look { };
nwg-menu = callPackage ../applications/misc/nwg-menu { };
nwg-panel = callPackage ../applications/misc/nwg-panel { };