nixos/templates/cxxWithXmake/flake.nix

57 lines
1.2 KiB
Nix
Raw Normal View History

{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-utils = {
url = "github:numtide/flake-utils";
};
};
outputs = {
self,
flake-utils,
nixpkgs,
...
}:
flake-utils.lib.eachDefaultSystem (system: let
pkgs = import nixpkgs {
inherit system;
};
in {
formatter = pkgs.alejandra;
2025-05-23 22:28:12 +08:00
checks = {
inherit (self.packages.${system}) default;
};
devShells.default = pkgs.mkShell {
2025-05-23 22:28:12 +08:00
inputsFrom = [] ++ (builtins.attrValues self.checks.${system});
packages = with pkgs; [
clang-tools
];
};
2025-05-23 22:28:12 +08:00
packages = rec {
cxx-demo = pkgs.stdenv.mkDerivation {
pname = "cxx-demo";
version = "unstable";
src = ./.;
strictDeps = true;
nativeBuildInputs = with pkgs; [
xmake
gnumake
];
preConfigure = ''
2025-05-24 08:21:51 +08:00
xmake config -m release
2025-05-23 22:28:12 +08:00
xmake project -k xmakefile
'';
env = {
INSTALLDIR = "${placeholder "out"}";
2025-05-24 08:21:51 +08:00
NIX_DEBUG = 1;
V = 1;
D = 1;
2025-05-23 22:28:12 +08:00
};
};
default = cxx-demo;
};
});
nixConfig = {
keepOutputs = true;
};
}