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

swappy: Init at 1.2.1 #81116

Merged
merged 1 commit into from
Sep 28, 2020
Merged
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
45 changes: 45 additions & 0 deletions pkgs/applications/misc/swappy/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{ stdenv, fetchFromGitHub
, meson
, ninja
, wayland
, cairo
, pango
, gtk
, pkgconfig
, cmake
, scdoc
, libnotify
, gio-sharp
, glib
}:

stdenv.mkDerivation rec {
name = "swappy-${version}";
version = "1.2.1";

src = fetchFromGitHub {
owner = "jtheoof";
repo = "swappy";
rev = "v${version}";
sha256 = "14ac2jmnak7avcz0jhqjm30vk7pv3gq5aq5rdyh84k8c613kkicf";
};

nativeBuildInputs = [ glib meson ninja pkgconfig cmake scdoc ];

buildInputs = [ cairo pango gtk libnotify wayland glib ];

strictDeps = true;

Copy link
Contributor

Choose a reason for hiding this comment

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

As for jtheoof/swappy#10 , try to add (untested):

  nativeBuildInputs = [ glibc.dev ];

Source: https://linux.die.net/man/3/clock_gettime + nix-locate unistd.h.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Did not work:

../src/buffer.c: In function 'randname':
../src/buffer.c:12:3: error: implicit declaration of function 'clock_gettime' [-Werror=implicit-function-declaration]
   12 |   clock_gettime(CLOCK_REALTIME, &ts);
      |   ^~~~~~~~~~~~~
../src/buffer.c:12:17: error: 'CLOCK_REALTIME' undeclared (first use in this function)
   12 |   clock_gettime(CLOCK_REALTIME, &ts);
      |                 ^~~~~~~~~~~~~~
../src/buffer.c:12:17: note: each undeclared identifier is reported only once for each function it appears in
../src/buffer.c: In function 'create_shm_file':
../src/buffer.c:45:7: error: implicit declaration of function 'ftruncate'; did you mean 'strncat'? [-Werror=implicit-function-declaration]
   45 |   if (ftruncate(fd, size) < 0) {
      |       ^~~~~~~~~
      |       strncat
cc1: all warnings being treated as errors

Copy link

Choose a reason for hiding this comment

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

This should be fixed now too.

Copy link
Contributor

@bbigras bbigras Jun 26, 2020

Choose a reason for hiding this comment

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

It builds with this change:

Suggested change
preConfigure = ''
sed -i "s#gio/gunixoutputstream.h#gio-unix-2.0/gio/gunixoutputstream.h#" src/pixbuf.c
'';

Copy link
Contributor

Choose a reason for hiding this comment

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

Or maybe there's a way to add ${glib.dev}/include/gio-unix-2.0 to the include path.

Copy link
Contributor

Choose a reason for hiding this comment

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

Just use:

  mesonFlags = [
    # TODO: https://github.com/NixOS/nixpkgs/issues/36468
    "-Dc_args=-I${glib.dev}/include/gio-unix-2.0"
  ];

and you can remove the nativeBuildInputs

Copy link
Contributor

Choose a reason for hiding this comment

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

and you can remove gio-sharp.

mesonFlags = [
# TODO: https://github.com/NixOS/nixpkgs/issues/36468
"-Dc_args=-I${glib.dev}/include/gio-unix-2.0"
];

meta = with stdenv.lib; {
homepage = "https://github.com/jtheoof/swappy";
description = "A Wayland native snapshot editing tool, inspired by Snappy on macOS ";
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe remove the whitespace at the end

license = licenses.mit;
maintainers = [ maintainers.matthiasbeyer ];
platforms = platforms.linux;
};
}
2 changes: 2 additions & 0 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2303,6 +2303,8 @@ in

bash-supergenpass = callPackage ../tools/security/bash-supergenpass { };

swappy = callPackage ../applications/misc/swappy { gtk = gtk3; };
Copy link
Contributor

Choose a reason for hiding this comment

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

flameshot, a similar tool is in pkgs/tools/misc/flameshot. Not sure if it's important.


sweep-visualizer = callPackage ../tools/misc/sweep-visualizer { };

syscall_limiter = callPackage ../os-specific/linux/syscall_limiter {};
Expand Down