diff --git a/flake/packages.nix b/flake/packages.nix index f569644..c1fcffe 100644 --- a/flake/packages.nix +++ b/flake/packages.nix @@ -17,48 +17,7 @@ build-system = with pkgs.python3.pkgs; [setuptools]; }; - switchyard = pkgs.buildGoModule { - pname = "switchyard"; - version = "dev"; - src = inputs.self; - vendorHash = "sha256-1rEtf5QJA5xaeL0LRp13dwtPCH+DM5Wp4kJXBBqNtEg="; - subPackages = ["src"]; - - buildPhase = '' - runHook preBuild - go build -trimpath -ldflags="-s -w" -o $GOPATH/bin/switchyard ./src - runHook postBuild - ''; - - nativeBuildInputs = with pkgs; [ - pkg-config - wrapGAppsHook4 - ]; - - buildInputs = with pkgs; [ - glib - gobject-introspection - gtk4 - libadwaita - pkg-config - ]; - - postInstall = '' - install -Dm644 data/io.github.alyraffauf.Switchyard.desktop \ - $out/share/applications/io.github.alyraffauf.Switchyard.desktop - - install -Dm644 data/icons/hicolor/scalable/apps/io.github.alyraffauf.Switchyard.svg \ - $out/share/icons/hicolor/scalable/apps/io.github.alyraffauf.Switchyard.svg - ''; - - meta = with pkgs.lib; { - description = "A configurable default browser for Linux"; - homepage = "https://github.com/alyraffauf/switchyard"; - license = licenses.gpl3Plus; - platforms = platforms.linux; - mainProgram = "switchyard"; - }; - }; + switchyard = pkgs.callPackage ../package.nix {}; }; }; } diff --git a/package.nix b/package.nix new file mode 100644 index 0000000..f35ae4b --- /dev/null +++ b/package.nix @@ -0,0 +1,51 @@ +{ + buildGoModule, + glib, + gobject-introspection, + gtk4, + libadwaita, + lib, + pkg-config, + wrapGAppsHook4, +}: +buildGoModule { + pname = "switchyard"; + version = "dev"; + src = ./.; + vendorHash = "sha256-1rEtf5QJA5xaeL0LRp13dwtPCH+DM5Wp4kJXBBqNtEg="; + subPackages = ["src"]; + + ldflags = [ + "-s" + "-w" + ]; + + nativeBuildInputs = [ + pkg-config + wrapGAppsHook4 + ]; + + buildInputs = [ + glib + gobject-introspection + gtk4 + libadwaita + pkg-config + ]; + + postInstall = '' + install -Dm644 data/io.github.alyraffauf.Switchyard.desktop \ + $out/share/applications/io.github.alyraffauf.Switchyard.desktop + + install -Dm644 data/icons/hicolor/scalable/apps/io.github.alyraffauf.Switchyard.svg \ + $out/share/icons/hicolor/scalable/apps/io.github.alyraffauf.Switchyard.svg + ''; + + meta = with lib; { + description = "A configurable default browser for Linux"; + homepage = "https://github.com/alyraffauf/switchyard"; + license = licenses.gpl3Plus; + platforms = platforms.linux; + mainProgram = "switchyard"; + }; +}