scanned-image-extractor/flake.nix

72 lines
1.5 KiB
Nix
Raw Normal View History

2024-01-29 23:24:54 +00:00
{
2024-02-01 00:09:04 +00:00
description = "A tool for efficiently extracting rectangular photographs.";
2024-01-29 23:24:54 +00:00
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
2024-02-01 00:09:04 +00:00
nix-appimage.url = "github:ralismark/nix-appimage";
2024-01-29 23:24:54 +00:00
};
outputs = {
self,
nixpkgs,
2024-02-01 00:09:04 +00:00
nix-appimage,
2024-01-29 23:24:54 +00:00
}: let
system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system};
in {
2024-02-01 00:09:04 +00:00
packages.${system} = let
name = "scannedImageExtractor";
in {
default = pkgs.gccStdenv.mkDerivation {
inherit name;
2024-01-29 23:24:54 +00:00
src = ./.;
2024-02-01 00:09:04 +00:00
nativeBuildInputs = with pkgs; [
cmake
opencv2
2024-01-29 23:24:54 +00:00
liblbfgs
2024-02-01 00:09:04 +00:00
qt5.full
libsForQt5.qt5.wrapQtAppsHook
2024-01-29 23:24:54 +00:00
];
2024-02-01 00:09:04 +00:00
dontUseCmakeConfigure = true;
2024-01-29 23:24:54 +00:00
buildPhase = ''
2024-02-01 00:09:04 +00:00
cmake scannerExtract -DCMAKE_BUILD_TYPE=release -DOPENCV2=1
2024-01-29 23:24:54 +00:00
make
'';
2024-02-01 00:09:04 +00:00
installPhase = ''
install -m 555 ${name} -Dt $out/bin
'';
};
appImage = let
src = nix-appimage.bundlers.${system}.default self.packages.${system}.default;
in
pkgs.stdenvNoCC.mkDerivation {
inherit name src;
dontUnpack = true;
dontBuild = true;
installPhase = ''
install -m 555 $src -D $out/${name}.AppImage
'';
};
};
devShells = {
default = pkgs.mkShellNoCC {
packages = with pkgs; [
cmake
opencv2
liblbfgs
gt5.full
appimage-run
];
2024-01-29 23:24:54 +00:00
};
};
};
}