sewing/flake.nix

66 lines
1.9 KiB
Nix
Raw Normal View History

2022-06-15 05:57:30 +02:00
{
2022-06-15 06:05:02 +02:00
description = "Sewing Tools";
2022-06-15 05:57:30 +02:00
inputs = {
nixpkgs.url = "github:nixos/nixpkgs";
flake-utils.url = "github:numtide/flake-utils";
};
outputs =
{ self
, nixpkgs
, flake-utils
}:
(flake-utils.lib.eachDefaultSystem (system:
let pkgs = nixpkgs.legacyPackages.${system};
in {
2022-06-15 07:35:31 +02:00
packages.valentina-061 = pkgs.libsForQt512.callPackage pkgs/valentina-0.6.1.nix { };
2022-06-15 05:57:30 +02:00
packages.valentina = self.packages.${system}.valentina-061;
2022-06-15 08:15:55 +02:00
packages.seamly2d = pkgs.libsForQt5.callPackage pkgs/seamly2d-2022-06-13.nix { };
2022-06-15 05:57:30 +02:00
# nix build
packages.default = self.packages.${system}.valentina;
# TODO: Legacy attribute, drop soon
defaultPackage = self.packages.${system}.default;
2022-06-17 08:54:31 +02:00
devShells.default = pkgs.mkShell {
buildInputs = [
2022-06-23 19:13:19 +02:00
# building seamly2d and valentina
2022-06-17 08:54:31 +02:00
pkgs.qt5.full
pkgs.qtcreator
pkgs.libGL
pkgs.qt5.qtsvg
pkgs.poppler_utils
pkgs.qt5.qtxmlpatterns
pkgs.qt5.qt3d
pkgs.qt5.qmake
2022-06-23 19:13:19 +02:00
# poster
pkgs.imagemagick
pkgs.ghostscript
# A4 is 2480 x 3508 Pixel
# A4 with 100px space on top bottom left and right is : 2280 x 3308 Pixel
(pkgs.writers.writeBashBin "posterize" ''
${pkgs.imagemagick}/bin/convert -density 300 -depth 8 -quality 85 input.pdf input.png
${pkgs.imagemagick}/bin/convert input.png -crop 2280x3308 +repage output_a4_%02d.png
for file in output_a4_*
do
${pkgs.imagemagick}/bin/convert \
$file \
-gravity center \
-background gray \
-extent 2480x3508 \
final_$file
done
${pkgs.imagemagick}/bin/convert final_*.png -quality 100 output.pdf
rm -rf *.png
'')
2022-06-17 08:54:31 +02:00
];
};
2022-06-15 05:57:30 +02:00
}));
}