From a5669dab71ed76b168e5e57d606fa4a5224866f9 Mon Sep 17 00:00:00 2001 From: LordGrimmauld Date: Tue, 9 Apr 2024 13:54:22 +0200 Subject: [PATCH] add nix tooling --- .gitignore | 6 +----- flake.lock | 26 ++++++++++++++++++++++++++ flake.nix | 27 +++++++++++++++++++++++++++ nix/package.nix | 39 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 93 insertions(+), 5 deletions(-) create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 nix/package.nix diff --git a/.gitignore b/.gitignore index ceb12ad..b2be92b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1 @@ -# User -*.user - -# Build directory -build/ +result diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..483a91b --- /dev/null +++ b/flake.lock @@ -0,0 +1,26 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1712604496, + "narHash": "sha256-Ye1R+k60uo0B3mn5xwsgb0PzceSg9y0E2OMYQnizLD0=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "ed6db4c403cc2fc4924d24e1a2a2f148c6152620", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "ref": "nixpkgs-unstable", + "type": "indirect" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..31cdf4e --- /dev/null +++ b/flake.nix @@ -0,0 +1,27 @@ +{ + description = "Gio wrapper for Qt6 applications"; + + inputs.nixpkgs.url = "nixpkgs/nixpkgs-unstable"; + + outputs = { + nixpkgs, + self, + ... + }: let + systems = [ + "x86_64-linux" + "aarch64-linux" + ]; + + forAllSystems = f: nixpkgs.lib.genAttrs systems (system: f system); + in { + packages = forAllSystems (system: let + pkgs = nixpkgs.legacyPackages.${system}; + gio-qt6-pkg = (pkgs.qt6Packages.callPackage ./nix/package.nix {}); + in { + gio-qt6 = gio-qt6-pkg; + default = gio-qt6-pkg; + }); + }; +} + diff --git a/nix/package.nix b/nix/package.nix new file mode 100644 index 0000000..6803865 --- /dev/null +++ b/nix/package.nix @@ -0,0 +1,39 @@ +{ stdenv +, lib +, fetchFromGitHub +, cmake +, pkg-config +, glibmm +, doxygen +, qt6 +, buildDocs ? true +}: + +stdenv.mkDerivation rec { + pname = "gio-qt6"; + version = "0.1.0"; + + src = lib.cleanSource ../.; + + nativeBuildInputs = [ + cmake + pkg-config + qt6.wrapQtAppsHook + ] ++ lib.optionals buildDocs [ doxygen qt6.qttools.dev ]; + + cmakeFlags = [ + "-DCMAKE_INSTALL_LIBDIR=lib" + "-DPROJECT_VERSION=${version}" + "-DBUILD_DOCS=OFF" + ] ++ lib.optionals (!buildDocs) [ "-DBUILD_DOCS=OFF" ]; + + propagatedBuildInputs = [ glibmm ]; + + meta = with lib; { + description = "Gio wrapper for Qt6 applications"; + homepage = "https://git.grimmauld.de/Grimmauld/gio-qt"; + license = licenses.lgpl3Plus; + platforms = platforms.linux; + maintainers = with maintainers; [grimmauld]; + }; +}