feat(packages): add omasnap

This commit is contained in:
tux
2026-09-17 21:24:52 +05:30
parent cdce741599
commit 2b3e4661b3
3 changed files with 76 additions and 2 deletions

View File

@@ -1,6 +1,7 @@
{inputs, ...}: {
flake.overlays = {
modifications = final: prev: {
omasnap = prev.callPackage ../../packages/omasnap.nix {};
tnvim = inputs.tnvim.packages.${prev.stdenv.hostPlatform.system}.default;
tshell = inputs.tshell.packages.${prev.stdenv.hostPlatform.system}.default;
trok = inputs.trok.packages.${prev.stdenv.hostPlatform.system}.default;
@@ -27,10 +28,14 @@
copyparty = inputs.copyparty.overlays.default;
};
perSystem = {system, ...}: {
_module.args.pkgs = import inputs.nixpkgs {
perSystem = {system, ...}: let
pkgs = import inputs.nixpkgs {
inherit system;
overlays = builtins.attrValues inputs.self.overlays;
};
in {
_module.args.pkgs = pkgs;
packages.omasnap = pkgs.omasnap;
};
}

View File

@@ -30,6 +30,7 @@
hyprshot
wl-clipboard
wl-screenrec
omasnap
(writeShellScriptBin "hypr-screenshot" ''
hyprshot -m region -r ppm - | satty --filename -
'')

68
packages/omasnap.nix Normal file
View File

@@ -0,0 +1,68 @@
{
lib,
stdenv,
cmake,
fetchFromGitHub,
hyprland,
kdePackages,
ninja,
pkg-config,
tesseract,
wayland,
wayland-protocols,
wayland-scanner,
wl-clipboard,
}:
stdenv.mkDerivation {
pname = "omasnap";
version = "v1.20.1";
src = fetchFromGitHub {
owner = "omacom";
repo = "omasnap";
rev = "d339588f3aba554f314d6233da2dddc98f83de55";
hash = "sha256-90p1lZDj4cksAAhpbJMQwN6cMqqcZyRVESMLpjmw294=";
};
postPatch = ''
substituteInPlace CMakeLists.txt \
--replace-fail "/usr/share/wayland-protocols" \
"${wayland-protocols}/share/wayland-protocols"
'';
nativeBuildInputs = [
cmake
kdePackages.wrapQtAppsHook
ninja
pkg-config
wayland-scanner
];
buildInputs = [
kdePackages.layer-shell-qt
kdePackages.qtbase
wayland
wayland-protocols
];
cmakeFlags = [(lib.cmakeBool "BUILD_TESTING" false)];
qtWrapperArgs = [
"--prefix"
"PATH"
":"
(lib.makeBinPath [
hyprland
tesseract
wl-clipboard
])
];
meta = {
description = "Fast Wayland screenshot and annotation overlay for Hyprland";
homepage = "https://github.com/omacom/omasnap";
license = lib.licenses.mit;
mainProgram = "omasnap";
platforms = lib.platforms.linux;
};
}