Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gnome shell extension pano #189091

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pkgs/desktops/gnome/extensions/manuallyPackaged.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"icon-hider@kalnitsky.org" = callPackage ./icon-hider { };
"impatience@gfxmonk.net" = callPackage ./impatience { };
"no-title-bar@jonaspoehler.de" = callPackage ./no-title-bar { };
"pano@elhan.io" = callPackage ./pano { };
"paperwm@hedning:matrix.org" = callPackage ./paperwm { };
"pidgin@muffinmad" = callPackage ./pidgin-im-integration { };
"pop-shell@system76.com" = callPackage ./pop-shell { };
Expand Down
110 changes: 110 additions & 0 deletions pkgs/desktops/gnome/extensions/pano/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
{ lib
, stdenv
, atk
, cogl
, fetchFromGitHub
, glib
, gnome
, gobject-introspection
, gsound
, gtk3
, libgda
, mkYarnModules
, nodePackages
, pango
, substituteAll
, yarn
}:

let
version = "10";
uuid = "pano@elhan.io";
pname = "gnome-shell-extension-pano";

girpathsPatch = (substituteAll {
src = ./set-dirpaths.patch;
gda_path = "${libgda}/lib/girepository-1.0";
gsound_path = "${gsound}/lib/girepository-1.0";
});
in
stdenv.mkDerivation rec {
inherit pname version;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not use those here directly, when we have rec attrset?

src = fetchFromGitHub {
owner = "oae";
repo = "gnome-shell-pano";
rev = "v${version}";
hash = "sha256-1vGiWSXlQ8xheqJsZm3uXCixuLl5NFM2OgPQrzCPhME=";
};

nativeBuildInputs = [
gobject-introspection
nodePackages.rollup
nodePackages.yarn
];

buildInputs = [
atk
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not see gtk3 and atk needed.

cogl
glib
gnome.gnome-shell
gnome.mutter
gsound
gtk3
libgda
pango
];

nodeModules =
mkYarnModules {
inherit pname version;
name = "${pname}-modules-${version}";
packageJSON = "${src}/package.json";
yarnLock = "${src}/yarn.lock";
yarnNix = ./yarn.nix;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not clear how to update this. Maybe add an passthru.updateScript. Did not test it but something like the following should work:

  passthru = {
    lockFileNix = runCommand
      "pano-yarn.nix"
      {
        nativeBuildInputs = [
          yarn2nix-moretea
        ];
      }
      ''
        unpackPhase
        cd "''${sourceRoot:-.}"
        yarn2nix > "$out"
      '';
    updateScript =
      let
        updateSource = gitUpdater { };
        updateLockFile = _experimental-update-script-combinators.copyAttrOutputToFile "gnomeExtensions.pano.lockFileNix" ./yarn.nix;
      in
      _experimental-update-script-combinators.sequence [
        updateSource
        updateLockFile
      ];
  };

};

postPatch = ''
substituteInPlace resources/metadata.json \
--replace '"version": 999' '"version": ${version}'
'';

buildPhase =
let
dataDirPaths = lib.concatStringsSep ":" [
"${gnome.gnome-shell}/share/gnome-shell"
"${gnome.mutter}/lib/mutter-10"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is now mutter-11. You can use gnome.mutter.libdir instead.

];
in
''
runHook preBuild

ln -sv "${nodeModules}/node_modules" node_modules
export XDG_DATA_DIRS="${dataDirPaths}:$XDG_DATA_DIRS"
yarn --offline build
# To avoid additional dependencies, we are patching here a generated file
# created by the previous command.
patch -d dist -p1 < ${girpathsPatch}

runHook postBuild
'';

passthru = {
extensionUuid = uuid;
extensionPortalSlug = "pano";
};

installPhase = ''
runHook preInstall
mkdir -p "$out/share/gnome-shell/extensions/${uuid}"
cp -r dist/* "$out/share/gnome-shell/extensions/${uuid}/"
runHook postInstall
'';

meta = with lib; {
description = "Next-gen Clipboard Manager for Gnome Shell";
license = licenses.gpl2Plus;
platforms = platforms.linux;
maintainers = [ maintainers.michojel ];
homepage = "https://github.com/oae/gnome-shell-pano";
};
}
10 changes: 10 additions & 0 deletions pkgs/desktops/gnome/extensions/pano/set-dirpaths.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Index: nixos/extension.js
===================================================================
--- nixos.orig/extension.js
+++ nixos/extension.js
@@ -1,3 +1,5 @@
+imports.gi.GIRepository.Repository.prepend_search_path('@gda_path@');
+imports.gi.GIRepository.Repository.prepend_search_path('@gsound_path@');

try {

Loading