From 5888b9e6bcf606ee2cd91e77b292d85abf7d175a Mon Sep 17 00:00:00 2001 From: Ingolf Wagner Date: Wed, 15 Jun 2022 05:57:30 +0200 Subject: [PATCH] init --- flake.nix | 30 +++++++++++++++++ pkgs/valentina-0.6.1.nix | 73 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 103 insertions(+) create mode 100644 flake.nix create mode 100644 pkgs/valentina-0.6.1.nix diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..2a2b545 --- /dev/null +++ b/flake.nix @@ -0,0 +1,30 @@ +{ + description = "Seamly 2D"; + + 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 { + + packages.valentina-061 = pkgs.libsForQt512.callPackage pkgs/valentina-0.6.1.nix {}; + packages.valentina = self.packages.${system}.valentina-061; + + packages.seamly2d = pkgs.libsForQt512.callPackage pkgs/seamly2d.nix {}; + + # nix build + packages.default = self.packages.${system}.valentina; + # TODO: Legacy attribute, drop soon + defaultPackage = self.packages.${system}.default; + + + })); +} diff --git a/pkgs/valentina-0.6.1.nix b/pkgs/valentina-0.6.1.nix new file mode 100644 index 0000000..8ac6c02 --- /dev/null +++ b/pkgs/valentina-0.6.1.nix @@ -0,0 +1,73 @@ +{ mkDerivation, lib, fetchFromGitLab +, qmake, qttools +, qtbase, qtsvg, qtxmlpatterns +, poppler_utils +}: + +with lib; + +mkDerivation rec { + pname = "valentina"; + version = "0.6.1"; + + #src = fetchhg { + # url = "https://bitbucket.org/dismine/valentina"; + # rev = "v${version}"; + # sha256 = "0dxk2av7xbsd233sr9wa1hamzb7pp8yx6p5b43rsnvnzchkqf423"; + #}; + src = fetchFromGitLab { + owner = "smart-pattern"; + repo = "valentina"; + rev = "v${version}"; + #sha256 = "sha256-N9fC2tCP4TVNncatHaz5W5Mp3jOmAcEWYCl30+0myaE="; + sha256 = "0dxk2av7xbsd233sr9wa1hamzb7pp8yx6p5b43rsnvnzchkqf423"; + }; + + postPatch = '' + substituteInPlace common.pri \ + --replace '$$[QT_INSTALL_HEADERS]/QtXmlPatterns' '${getDev qtxmlpatterns}/include/QtXmlPatterns' \ + --replace '$$[QT_INSTALL_HEADERS]/QtSvg' '${getDev qtsvg}/include/QtSvg' \ + --replace '$$[QT_INSTALL_HEADERS]/' '${getDev qtbase}/include/' \ + --replace '$$[QT_INSTALL_HEADERS]' '${getDev qtbase}' + substituteInPlace src/app/tape/tape.pro \ + --replace '$$[QT_INSTALL_BINS]/rcc' '${getDev qtbase}/bin/rcc' + substituteInPlace src/app/translations.pri \ + --replace '$$[QT_INSTALL_BINS]/$$LRELEASE' '${getDev qttools}/bin/lrelease' + substituteInPlace src/app/valentina/mainwindowsnogui.cpp \ + --replace 'define PDFTOPS "pdftops"' 'define PDFTOPS "${getBin poppler_utils}/bin/pdftops"' + substituteInPlace src/app/valentina/dialogs/dialogsavelayout.h \ + --replace 'define PDFTOPS "pdftops"' 'define PDFTOPS "${getBin poppler_utils}/bin/pdftops"' + ''; + + nativeBuildInputs = [ qmake qttools ]; + + buildInputs = [ qtbase qtsvg qtxmlpatterns poppler_utils ]; + + configurePhase = '' + qmake PREFIX=/ Valentina.pro -r "CONFIG += noTests noRunPath no_ccache noDebugSymbols" + ''; + + installFlags = [ "INSTALL_ROOT=$(out)" ]; + + postInstall = '' + mv $out/usr/share $out/ + rmdir $out/usr + + mkdir -p $out/share/man/man1 + gzip -9c dist/debian/valentina.1 > $out/share/man/man1/valentina.1.gz + gzip -9c dist/debian/tape.1 > $out/share/man/man1/tape.1.gz + + mkdir -p $out/share/mime/packages + cp dist/debian/valentina.sharedmimeinfo $out/share/mime/packages/valentina.xml + ''; + + enableParallelBuilding = true; + + meta = { + description = "An open source sewing pattern drafting software"; + homepage = "https://valentinaproject.bitbucket.io/"; + license = licenses.gpl3; + platforms = platforms.linux; + maintainers = with maintainers; [ jfrankenau ]; + }; +}