Add C (meson) Template

This commit is contained in:
2023-08-23 22:47:55 -04:00
parent 11e3bb4a47
commit 5a2f120cf1
2 changed files with 93 additions and 0 deletions

View File

@@ -11,6 +11,9 @@
python = t ./flakes/python ''
Basic Python Environment Template
'';
c = t ./flakes/c ''
C Based Meson Project
'';
default = basic;
};
};

90
flakes/c/flake.nix Normal file
View File

@@ -0,0 +1,90 @@
{
description = "Syzygui - Cross Platform Vulkan Based GUI Framework";
inputs.flake-utils.url = "github:numtide/flake-utils";
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system: let
version = "0.0.1";
name = "PACKAGE";
pkgs = import nixpkgs {
inherit system;
};
deps = (with pkgs; [
]);
propDeps = (with pkgs; [
]) ++ (pkgs.lib.optionals pkgs.stdenv.isDarwin (with pkgs; [
]));
project = pkgs.stdenv.mkDerivation {
pname = name;
inherit version;
src = ./.;
nativeBuildInputs = with pkgs; [
meson
ninja
pkg-config
];
buildInputs = deps ++ (with pkgs; [
]);
propagatedBuildInputs = propDeps ++ (with pkgs; [
]);
};
# Pseudo Dev for Not Rebuilding During Development
project-dev = pkgs.stdenv.mkDerivation {
name = "${name}-dev";
src = ./include;
installPhase = ''
mkdir -p $out/include
cp -r * $out/include
'';
};
project-examples = pkgs.stdenv.mkDerivation {
pname = "${name}-examples";
inherit version;
src = ./examples;
nativeBuildInputs = with pkgs; [
meson
ninja
pkg-config
];
buildInputs = deps ++ (with pkgs; [
"${name}"
]);
};
in {
packages = {
default = project;
examples = if (builtins.pathExists ./examples) then project-examples else pkgs.writeText "No Examples" ''
No "examples" in root directory, make an examples dir for examples.
'';
};
apps = rec {
default = flake-utils.lib.mkApp { drv = self.packages.${system}.default; };
};
devShells.default = pkgs.mkShell {
C_INCLUDE_PATH = "./include";
packages = deps ++ propDeps ++ (with pkgs; [
project-dev
clang-tools
meson
]);
};
}
);
}