Add C (meson) Template
This commit is contained in:
@@ -11,6 +11,9 @@
|
|||||||
python = t ./flakes/python ''
|
python = t ./flakes/python ''
|
||||||
Basic Python Environment Template
|
Basic Python Environment Template
|
||||||
'';
|
'';
|
||||||
|
c = t ./flakes/c ''
|
||||||
|
C Based Meson Project
|
||||||
|
'';
|
||||||
default = basic;
|
default = basic;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
90
flakes/c/flake.nix
Normal file
90
flakes/c/flake.nix
Normal 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
|
||||||
|
]);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user