From 03636438a01b27ee540decbea28214eecdab6a3c Mon Sep 17 00:00:00 2001 From: ulic-youthlic Date: Fri, 23 May 2025 22:28:12 +0800 Subject: [PATCH] add package for cxx template --- templates/cxxWithXmake/flake.nix | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/templates/cxxWithXmake/flake.nix b/templates/cxxWithXmake/flake.nix index 7ccaf94..4b6eda2 100644 --- a/templates/cxxWithXmake/flake.nix +++ b/templates/cxxWithXmake/flake.nix @@ -18,14 +18,34 @@ }; in { formatter = pkgs.alejandra; + checks = { + inherit (self.packages.${system}) default; + }; devShells.default = pkgs.mkShell { + inputsFrom = [] ++ (builtins.attrValues self.checks.${system}); packages = with pkgs; [ clang-tools - - gcc - xmake ]; }; + packages = rec { + cxx-demo = pkgs.stdenv.mkDerivation { + pname = "cxx-demo"; + version = "unstable"; + src = ./.; + strictDeps = true; + nativeBuildInputs = with pkgs; [ + xmake + gnumake + ]; + preConfigure = '' + xmake project -k xmakefile + ''; + env = { + INSTALLDIR = "${placeholder "out"}"; + }; + }; + default = cxx-demo; + }; }); nixConfig = { keepOutputs = true;