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

screenkey: init at 0.9 #34167

Merged
merged 2 commits into from Feb 27, 2018
Merged

screenkey: init at 0.9 #34167

merged 2 commits into from Feb 27, 2018

Conversation

rasendubi
Copy link
Member

Motivation for this change
Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option build-use-sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

@@ -4514,6 +4514,10 @@ with pkgs;
quazip = quazip_qt4;
};

screenkey = callPackage ../applications/video/screenkey {
Copy link
Member

Choose a reason for hiding this comment

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

Better use python2Packages.callPackage. Then you can leave out line 4518.

meta = with lib; {
homepage = https://www.thregr.org/~wavexx/software/screenkey/;
description = "A screencast tool to display your keys inspired by Screenflick";
license = licenses.gpl3;
Copy link
Member

Choose a reason for hiding this comment

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

This should be gpl3Plus.

@rasendubi
Copy link
Member Author

@dotlambda, thanks for the review—fixed!

buildInputs = [
distutils_extra
setuptools-git
intltool
Copy link
Member

Choose a reason for hiding this comment

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

Why didn't you include all dependencies from https://www.thregr.org/~wavexx/software/screenkey/#installation-and-basic-usage?
Also, some of these should go into nativeBuildInputs since they are only needed for building. See https://nixos.org/nixpkgs/manual/#ssec-stdenv-attributes.

Copy link
Member Author

Choose a reason for hiding this comment

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

slop is an optional runtime dependency and is not required for normal operation. (Even "install dependencies" command for Ubuntu/Debian does not list it.)

As for nativeBuildInputs, I agree. (Developed the expression on top of the stable channel and it does not feature nativeBuildInputs as a separate argument in mk-python-derivation yet.)

Copy link
Member

Choose a reason for hiding this comment

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

👍

buildPythonApplication rec {
name = "screenkey-0.9";

src = fetchFromGitHub {
Copy link
Member

Choose a reason for hiding this comment

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

Why don't you use https://www.thregr.org/~wavexx/software/screenkey/releases/screenkey-0.9.tar.gz?
Also, you could specify pname and version and leave out name.
Sorry for the many comments :)

Copy link
Member Author

Choose a reason for hiding this comment

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

IDK, fetchFromGitHub is more convenient to use. GitHub is also less likely to die or move.

Don't see a point in using pname and version—I am using name as rev (and reconstructing it from pname and version would remove all the benefit)

Copy link
Member

Choose a reason for hiding this comment

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

Alright, as you wish.

Copy link
Member

Choose a reason for hiding this comment

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

Please do use pname and version since in long term buildPython* will likely get rid of name.

Copy link
Member Author

Choose a reason for hiding this comment

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

ok, fixed

buildInputs = [
distutils_extra
setuptools-git
intltool
Copy link
Member

Choose a reason for hiding this comment

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

👍

buildPythonApplication rec {
name = "screenkey-0.9";

src = fetchFromGitHub {
Copy link
Member

Choose a reason for hiding this comment

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

Please do use pname and version since in long term buildPython* will likely get rid of name.

];

makeWrapperArgs = [
"--set LD_LIBRARY_PATH ${libX11}/lib:${libXtst}/lib"
Copy link
Member

Choose a reason for hiding this comment

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

Have you considered patching instead?

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

You would create paths.patch

--- a/Screenkey/xlib.py
+++ b/Screenkey/xlib.py
@@ -6,7 +6,7 @@
 from ctypes import *
 
 ## base X11
-libX11 = CDLL('libX11.so.6')
+libX11 = CDLL('@libX11@/lib/libX11.so.6')
 
 # types
 Atom = c_ulong
@@ -278,7 +278,7 @@
 
 
 ## record extensions
-libXtst = CDLL('libXtst.so.6')
+libXtst = CDLL('@libXtst@/lib/libXtst.so.6')
 
 # types
 XPointer = String

Then you would add

{
patches = [
  (substituteAll {
    src = ./paths.patch;
    inherit libX11 libXtst;
  })
];
}

Copy link
Member

Choose a reason for hiding this comment

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

.so can be replaced with ${stdenv.hostPlatform.extensions.sharedLibrary}

@grahamc
Copy link
Member

grahamc commented Jan 24, 2018

@GrahamcOfBorg build screenkey

Copy link

@GrahamcOfBorg GrahamcOfBorg left a comment

Choose a reason for hiding this comment

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

Failure for system: x86_64-darwin

Package ‘screenkey-0.9’ in /Users/graham/nix-borg/repo/38dca4e3aa6bca43ea96d2fcc04e8229/builder/grahamc-zoidberg/pkgs/applications/video/screenkey/default.nix:38 is not supported on ‘x86_64-darwin’, refusing to evaluate.

a) For `nixos-rebuild` you can set
  { nixpkgs.config.allowBroken = true; }
in configuration.nix to override this.

b) For `nix-env`, `nix-build`, `nix-shell` or any other Nix command you can add
  { allowBroken = true; }
to ~/.config/nixpkgs/config.nix.

Copy link

@GrahamcOfBorg GrahamcOfBorg left a comment

Choose a reason for hiding this comment

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

Success for system: x86_64-linux

reading manifest template 'MANIFEST.in'
warning: no previously-included files found matching '.gitignore'
writing manifest file 'screenkey.egg-info/SOURCES.txt'
running build_ext

----------------------------------------------------------------------
Ran 0 tests in 0.000s

OK
/nix/store/n55akhflgwfcvr9636hzv5akqh4kir09-screenkey-0.9

@FRidh
Copy link
Member

FRidh commented Jan 24, 2018

Ran 0 tests in 0.000s

No tests are found. Either the test runner cannot find tests and needs to be patched, or there simply are no tests in which case the tests need to be disabled. Do include a comment explaining why the tests are disabled.

@rasendubi
Copy link
Member Author

There are no tests.

Why should the check phase be disabled? It is not failing and runs within a second so it does no harm. Furthermore, if upstream adds tests, it's very likely the check phase won't be re-enabled. Am I missing something?

Copy link

@GrahamcOfBorg GrahamcOfBorg left a comment

Choose a reason for hiding this comment

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

Success for system: aarch64-linux

reading manifest template 'MANIFEST.in'
warning: no previously-included files found matching '.gitignore'
writing manifest file 'screenkey.egg-info/SOURCES.txt'
running build_ext

----------------------------------------------------------------------
Ran 0 tests in 0.000s

OK
/nix/store/rvqy26hbac7xy798z1kiavjy85hnzgj8-screenkey-0.9

@rasendubi
Copy link
Member Author

Replaced the wrapper hack with a patch to screenkey.

@GrahamcOfBorg build screenkey

@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Partial log (click to expand)

reading manifest template 'MANIFEST.in'
warning: no previously-included files found matching '.gitignore'
writing manifest file 'screenkey.egg-info/SOURCES.txt'
running build_ext

----------------------------------------------------------------------
Ran 0 tests in 0.000s

OK
/nix/store/by7l0zznla90z0wfapp0gyndn0ylqdk4-screenkey-0.9

@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Partial log (click to expand)

reading manifest template 'MANIFEST.in'
warning: no previously-included files found matching '.gitignore'
writing manifest file 'screenkey.egg-info/SOURCES.txt'
running build_ext

----------------------------------------------------------------------
Ran 0 tests in 0.000s

OK
/nix/store/sgjv2d5xlang64xpq34ncakvgmhzi39r-screenkey-0.9

@dotlambda
Copy link
Member

The comment should be added in order not to confuse other contributors. When I see "Ran 0 tests in 0.000s", I sometimes try to look up what the correct checkPhase would be, in this case just to find that there are no tests. If you disable tests and add a comment, everyone will know that it's fine like that.

@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Partial log (click to expand)

/tmp/nix-build-screenkey-0.9.drv-0/source
glibPreFixupPhase
post-installation fixup
shrinking RPATHs of ELF executables and libraries in /nix/store/dy15wvpyr9ikyaz8fb73ha69ymfzd3al-screenkey-0.9
strip is /nix/store/5qj61lcvzlap87rf6blvf8p577d482bv-binutils-2.28.1/bin/strip
stripping (with command strip and flags -S) in /nix/store/dy15wvpyr9ikyaz8fb73ha69ymfzd3al-screenkey-0.9/lib  /nix/store/dy15wvpyr9ikyaz8fb73ha69ymfzd3al-screenkey-0.9/bin 
patching script interpreter paths in /nix/store/dy15wvpyr9ikyaz8fb73ha69ymfzd3al-screenkey-0.9
checking for references to /tmp/nix-build-screenkey-0.9.drv-0 in /nix/store/dy15wvpyr9ikyaz8fb73ha69ymfzd3al-screenkey-0.9...
wrapping `/nix/store/dy15wvpyr9ikyaz8fb73ha69ymfzd3al-screenkey-0.9/bin/screenkey'...
/nix/store/dy15wvpyr9ikyaz8fb73ha69ymfzd3al-screenkey-0.9

@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Partial log (click to expand)

/build/source
glibPreFixupPhase
post-installation fixup
shrinking RPATHs of ELF executables and libraries in /nix/store/vq6h7ncm1x6aqgkfy3yn6qsss6hh8p9i-screenkey-0.9
strip is /nix/store/xmpjypwjmp2qi1chs5kr0hacnh161ls4-binutils-2.28.1/bin/strip
stripping (with command strip and flags -S) in /nix/store/vq6h7ncm1x6aqgkfy3yn6qsss6hh8p9i-screenkey-0.9/lib  /nix/store/vq6h7ncm1x6aqgkfy3yn6qsss6hh8p9i-screenkey-0.9/bin
patching script interpreter paths in /nix/store/vq6h7ncm1x6aqgkfy3yn6qsss6hh8p9i-screenkey-0.9
checking for references to /build in /nix/store/vq6h7ncm1x6aqgkfy3yn6qsss6hh8p9i-screenkey-0.9...
wrapping `/nix/store/vq6h7ncm1x6aqgkfy3yn6qsss6hh8p9i-screenkey-0.9/bin/screenkey'...
/nix/store/vq6h7ncm1x6aqgkfy3yn6qsss6hh8p9i-screenkey-0.9

@jtojnar jtojnar mentioned this pull request Feb 12, 2018
8 tasks
@jtojnar
Copy link
Contributor

jtojnar commented Feb 12, 2018

Apparently, we already have screenkey in pkgs/top-level/python-packages.nix could you change the the derivation there to pkgs.screenkey as a legacy alias?

nativeBuildInputs = [
distutils_extra
setuptools-git
intltool
Copy link
Member

Choose a reason for hiding this comment

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

Adding wrapGAppsHook in nativeBuildInputs and defaultIconTheme, hicolor_icon_theme in buildInputs should provide icons regardless of the desktop environments. The other pull request for screenkey seems to do something similar: #34898

@rasendubi
Copy link
Member Author

@Mic92, updated to include icons.

@jtojnar, I removed pythonPackages.screenkey. (Don't think it deserves an alias as I believe nobody is using it.)

@vidbina would you like to review/test as well?

@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Partial log (click to expand)

hicolorPreFixupPhase
post-installation fixup
Wrapping program /nix/store/f7884fmzbbbrmlqvjcrkxgb0lnkpm7yn-screenkey-0.9/bin/screenkey
shrinking RPATHs of ELF executables and libraries in /nix/store/f7884fmzbbbrmlqvjcrkxgb0lnkpm7yn-screenkey-0.9
strip is /nix/store/5qj61lcvzlap87rf6blvf8p577d482bv-binutils-2.28.1/bin/strip
stripping (with command strip and flags -S) in /nix/store/f7884fmzbbbrmlqvjcrkxgb0lnkpm7yn-screenkey-0.9/lib  /nix/store/f7884fmzbbbrmlqvjcrkxgb0lnkpm7yn-screenkey-0.9/bin 
patching script interpreter paths in /nix/store/f7884fmzbbbrmlqvjcrkxgb0lnkpm7yn-screenkey-0.9
checking for references to /tmp/nix-build-screenkey-0.9.drv-0 in /nix/store/f7884fmzbbbrmlqvjcrkxgb0lnkpm7yn-screenkey-0.9...
wrapping `/nix/store/f7884fmzbbbrmlqvjcrkxgb0lnkpm7yn-screenkey-0.9/bin/.screenkey-wrapped'...
/nix/store/f7884fmzbbbrmlqvjcrkxgb0lnkpm7yn-screenkey-0.9

propagatedBuildInputs = [
pygtk

defaultIconTheme
Copy link
Contributor

Choose a reason for hiding this comment

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

The icon themes do not need to be propagated, actually the hicolor_icon_theme is only used for setup hook.

Copy link
Member Author

Choose a reason for hiding this comment

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

Oops. Wrong section.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed.


buildInputs = [
defaultIconTheme
hicolor_icon_theme
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe also add comment that it is added for setup hook – or remove it, since it is propagated by adwaita-icon-theme.

@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Partial log (click to expand)

glibPreFixupPhase
post-installation fixup
Wrapping program /nix/store/bqq6bdjf4d60bzs6f6ap1wskjphwh2k0-screenkey-0.9/bin/screenkey
shrinking RPATHs of ELF executables and libraries in /nix/store/bqq6bdjf4d60bzs6f6ap1wskjphwh2k0-screenkey-0.9
strip is /nix/store/5qj61lcvzlap87rf6blvf8p577d482bv-binutils-2.28.1/bin/strip
stripping (with command strip and flags -S) in /nix/store/bqq6bdjf4d60bzs6f6ap1wskjphwh2k0-screenkey-0.9/lib  /nix/store/bqq6bdjf4d60bzs6f6ap1wskjphwh2k0-screenkey-0.9/bin 
patching script interpreter paths in /nix/store/bqq6bdjf4d60bzs6f6ap1wskjphwh2k0-screenkey-0.9
checking for references to /tmp/nix-build-screenkey-0.9.drv-0 in /nix/store/bqq6bdjf4d60bzs6f6ap1wskjphwh2k0-screenkey-0.9...
wrapping `/nix/store/bqq6bdjf4d60bzs6f6ap1wskjphwh2k0-screenkey-0.9/bin/.screenkey-wrapped'...
/nix/store/bqq6bdjf4d60bzs6f6ap1wskjphwh2k0-screenkey-0.9

@GrahamcOfBorg
Copy link

Failure on aarch64-linux (full log)

Partial log (click to expand)

   Compiling rustc_mir v0.0.0 (file:///build/rustc-1.22.1-src/src/librustc_mir)
   Compiling rustc_passes v0.0.0 (file:///build/rustc-1.22.1-src/src/librustc_passes)
building of '/nix/store/1q00yw9nphvwvxyk6imxny1rk76rwqy1-rustc-1.22.1.drv' timed out after 3200 seconds
cannot build derivation '/nix/store/i63b6jfgcjz1qkbwsljw4y9vrdsq0qr3-cargo-0.23.0.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/54gwpxhrss33zvavc8qpv9kvca66ja7j-librsvg-2.42.2.drv': 2 dependencies couldn't be built
cannot build derivation '/nix/store/4sgr9nibc20a50wqj0m0slhxnb5wsy2d-hook.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/ww752cmphyqnpsqafrhdmq5yzqh3l8v2-icon-naming-utils-0.8.90.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/b1lgn81fw7nxik79zjwshvggx28qgi14-adwaita-icon-theme-3.26.1.drv': 2 dependencies couldn't be built
cannot build derivation '/nix/store/hvnmgk51fah6qy6fbzj4mi1winpna3yw-screenkey-0.9.drv': 2 dependencies couldn't be built
error: build of '/nix/store/hvnmgk51fah6qy6fbzj4mi1winpna3yw-screenkey-0.9.drv' failed

@rasendubi
Copy link
Member Author

Ok, guys. I went through, like, 6-8 review rounds, and I have little energy to move it forward this way.

If there are no blockers, I would like to get this merged as is. If you have any improvements in mind, feel free to push into my branch.

@GrahamcOfBorg
Copy link

Failure on aarch64-linux (full log)

Partial log (click to expand)

   Compiling rustc_borrowck v0.0.0 (file:///build/rustc-1.22.1-src/src/librustc_borrowck)
   Compiling rustc_plugin v0.0.0 (file:///build/rustc-1.22.1-src/src/librustc_plugin)
building of '/nix/store/1q00yw9nphvwvxyk6imxny1rk76rwqy1-rustc-1.22.1.drv' timed out after 3600 seconds
cannot build derivation '/nix/store/i63b6jfgcjz1qkbwsljw4y9vrdsq0qr3-cargo-0.23.0.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/54gwpxhrss33zvavc8qpv9kvca66ja7j-librsvg-2.42.2.drv': 2 dependencies couldn't be built
cannot build derivation '/nix/store/4sgr9nibc20a50wqj0m0slhxnb5wsy2d-hook.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/ww752cmphyqnpsqafrhdmq5yzqh3l8v2-icon-naming-utils-0.8.90.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/b1lgn81fw7nxik79zjwshvggx28qgi14-adwaita-icon-theme-3.26.1.drv': 2 dependencies couldn't be built
cannot build derivation '/nix/store/mka1qxai26bjzqapx40r70c032r96pna-screenkey-0.9.drv': 2 dependencies couldn't be built
error: build of '/nix/store/mka1qxai26bjzqapx40r70c032r96pna-screenkey-0.9.drv' failed

@vidbina
Copy link
Contributor

vidbina commented Feb 12, 2018 via email

@vidbina
Copy link
Contributor

vidbina commented Feb 12, 2018

@rasendubi, on my setup this fails with

DEBUG:Screenkey:Options loaded.
DEBUG:Screenkey:Restarting LabelManager.
DEBUG:Screenkey:Thread started.
DEBUG:Screenkey:Restarting LabelManager.
Exception in thread Thread-1:
Traceback (most recent call last):
  File /nix/store/i3bx1iw2d0i3vh9sa1nf92ynlrw324w8-python-2.7.14/lib/python2.7/threading.py, line 801, in __bootstrap_inner
    self.run()
  File /nix/store/r7dqmjgcp6y72939rwsm0x941k7kd78y-screenkey-0.9/lib/python2.7/site-packages/Screenkey/keylistener.py, line 245, in run
    raise Exception(Cannot initialize input method)
Exception: Cannot initialize input method

zsh: terminated  ./result/bin/screenkey -d

It fails on the XopenIM call which I resolved in my old PR ( #34898) by unsetting XMODIFIERS. Using wrapProgram I kind of know how to do this the "right" way more or less, but with wrapGAppsHook I figured appending to gappsWrapperArgs would suffice eventhough there aren't any examples of unsetting variables this way in the entire nixpkgs repository so far... or my grep was lousy.

I proposed a PR to this PR to keep some work of @rasendubi's shoulders. I understand it's been much 😅, so @jtojnar and @dotlambda please weigh in on this and provide some feedback. I'm not familiar with unsetting variables using the wrapsGAppsHook helper, so the proposed change may not be idiomatic or "clean" in which case I'd like to know how to clean things up 😉

@jtojnar
Copy link
Contributor

jtojnar commented Feb 12, 2018

Using gappsWrapperArgs is the right way since the setup hook basically just passes it to wrapProgram

wrapProgram "${file}" "${gappsWrapperArgs[@]}"
. I am not convinced this is a right solution, though. What is the content of the variable? Do other GTK 2 applications work for you?

@vidbina
Copy link
Contributor

vidbina commented Feb 13, 2018

@jtojnar, yeah other GTK 2 apps work for me. In my case XMODIFIERS has been set to @xm=ibus because I enabled I-Bus as the input method to be able to enter Hiragana, Katakana and Emoji characters.

Enabling an input method sets XMODIFIERS and the modifier var is checked by the i18n xlib XSetLocaleModifiers function which is an important puzzle piece in managing XOpenIM's default behaviour.

Between input methods such as fcitx, ibus, nabi or uim and the method XopenIM I'm not exactly sure what the problem is. I see that XopenIM calls _XOpenLC📖 :octocat: which I figure then bumps into an invalid locale loader or a situation where all locale loaders failed to load an locale.

Several threads online proposed the unset XMODIFIERS as a quick-fix, there is even another nixpkgs package that does that (some Steam game, I believe) so there is a precedent for this approach.

It probably won't win the pageant but it is a pragmatic fix for those who use non-latin input methods.

@Mic92 Mic92 merged commit 1beee1c into NixOS:master Feb 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants