58 lines
1.2 KiB
Nix
58 lines
1.2 KiB
Nix
{
|
|
description = "Description for the project";
|
|
|
|
inputs = {
|
|
flake-parts.url = "github:hercules-ci/flake-parts";
|
|
nixpkgs.url = "github:nixos/nixpkgs/nixos-25.11";
|
|
devshell.url = "github:numtide/devshell";
|
|
};
|
|
|
|
outputs =
|
|
inputs@{
|
|
flake-parts,
|
|
nixpkgs,
|
|
...
|
|
}:
|
|
|
|
flake-parts.lib.mkFlake { inherit inputs; } {
|
|
imports = [
|
|
inputs.devshell.flakeModule
|
|
];
|
|
systems = nixpkgs.lib.systems.flakeExposed;
|
|
perSystem =
|
|
{
|
|
self',
|
|
pkgs,
|
|
system,
|
|
lib,
|
|
...
|
|
}:
|
|
{
|
|
packages.parser = pkgs.stdenv.mkDerivation {
|
|
pname = "feng parser";
|
|
version = "1.0";
|
|
src = ./grammar;
|
|
buildInputs = with pkgs; [
|
|
clang
|
|
peg
|
|
];
|
|
buildPhase = ''
|
|
peg -o peg.c grammar.peg
|
|
clang parser.c -o parser
|
|
'';
|
|
|
|
installPhase = ''
|
|
mkdir -p $out/bin
|
|
install parser $out/bin/parser
|
|
'';
|
|
};
|
|
devShells.default = pkgs.mkShell {
|
|
buildInputs = [
|
|
self'.packages.parser
|
|
];
|
|
};
|
|
};
|
|
flake = {
|
|
};
|
|
};
|
|
}
|