From dc47d4276108aa3fabae4f26d63cf313931684df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magnus=20Gro=C3=9F?= Date: Fri, 24 Nov 2023 23:30:16 +0100 Subject: [PATCH] nix: Wrap FetchContent --- .gitignore | 1 + flake.lock | 6 +++--- flake.nix | 12 ++++++++++-- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 8fd716f..b18dc3a 100644 --- a/.gitignore +++ b/.gitignore @@ -50,3 +50,4 @@ latex/ .cache/ .gitattributes +/result diff --git a/flake.lock b/flake.lock index 7bdd046..3a84ed9 100644 --- a/flake.lock +++ b/flake.lock @@ -20,11 +20,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1699099776, - "narHash": "sha256-X09iKJ27mGsGambGfkKzqvw5esP1L/Rf8H3u3fCqIiU=", + "lastModified": 1700612854, + "narHash": "sha256-yrQ8osMD+vDLGFX7pcwsY/Qr5PUd6OmDMYJZzZi0+zc=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "85f1ba3e51676fa8cc604a3d863d729026a6b8eb", + "rev": "19cbff58383a4ae384dea4d1d0c823d72b49d614", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 29062bf..8cbbb69 100644 --- a/flake.nix +++ b/flake.nix @@ -10,6 +10,12 @@ pkgs = nixpkgs.legacyPackages.${system}; stdenvs = [ { name = "gcc"; pkg = pkgs.gcc13Stdenv; } { name = "clang"; pkg = pkgs.llvmPackages_16.stdenv; } ]; defaultStdenv = (builtins.head stdenvs).name; + quartz = pkgs.fetchFromGitHub { + owner = "vimpostor"; + repo = "quartz"; + rev = builtins.head (builtins.match ".*FetchContent_Declare\\(.*GIT_TAG ([[:alnum:]\\.]+).*" (builtins.readFile ./CMakeLists.txt)); + hash = "sha256-KSuwXPUMZKx8nm8XnXHvj07GQtJAAnfIkRM6vbYllT0="; + }; makeStdenvPkg = env: env.mkDerivation { pname = "blobdrop"; version = builtins.head (builtins.match ".*project\\([[:alnum:]]+ VERSION ([0-9]+\.[0-9]+).*" (builtins.readFile ./CMakeLists.txt)); @@ -18,10 +24,10 @@ nativeBuildInputs = with pkgs; [ cmake + git pkg-config qt6.wrapQtAppsHook ]; - buildInputs = with pkgs; [ qt6.qtbase qt6.qtdeclarative @@ -29,6 +35,8 @@ xorg.libxcb xorg.xcbutilwm ]; + + cmakeFlags = [("-DFETCHCONTENT_SOURCE_DIR_QUARTZ=" + quartz)]; }; in { packages = rec { @@ -38,7 +46,7 @@ format = pkgs.runCommand "format" { src = ./.; nativeBuildInputs = [ pkgs.clang-tools pkgs.git ]; } "mkdir $out && cd $src && find . -type f -path './*\\.[hc]pp' -exec clang-format -style=file --dry-run --Werror {} \\;"; tests = (makeStdenvPkg pkgs.gcc13Stdenv).overrideAttrs (finalAttrs: previousAttrs: { doCheck = true; - cmakeFlags = ["-DBUILD_TESTING=ON"]; + cmakeFlags = previousAttrs.cmakeFlags ++ ["-DBUILD_TESTING=ON"]; QT_QPA_PLATFORM = "offscreen"; }); };