flake: Added workbench files_handling derivation
This commit is contained in:
parent
559e0432e8
commit
0fa919ef2d
16
flake.nix
16
flake.nix
@ -1,10 +1,11 @@
|
||||
{
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
|
||||
cclyzerpp.url = "github:peperunas/cclyzerpp/flake";
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, flake-utils }:
|
||||
outputs = { self, nixpkgs, flake-utils, cclyzerpp }:
|
||||
flake-utils.lib.eachDefaultSystem (system:
|
||||
let
|
||||
pkgs = import nixpkgs {
|
||||
@ -15,9 +16,20 @@
|
||||
shellWithPkgs = packages: pkgs.mkShell {
|
||||
inherit packages;
|
||||
};
|
||||
|
||||
cclyzer = cclyzerpp.defaultPackage.${system};
|
||||
|
||||
shell = with pkgs; shellWithPkgs [ codeql klee souffle cclyzer ];
|
||||
in
|
||||
{
|
||||
devShells.default = shellWithPkgs [ pkgs.codeql ];
|
||||
packages = rec {
|
||||
workbench = {
|
||||
files_handling = pkgs.callPackage ./workbench/files_handling/default.nix { cclyzerpp = cclyzer; };
|
||||
};
|
||||
|
||||
default = workbench.files_handling;
|
||||
};
|
||||
devShell = shell;
|
||||
});
|
||||
}
|
||||
|
||||
|
29
workbench/files_handling/default.nix
Normal file
29
workbench/files_handling/default.nix
Normal file
@ -0,0 +1,29 @@
|
||||
{ stdenv, clang, cclyzerpp }:
|
||||
|
||||
stdenv.mkDerivation {
|
||||
pname = "example";
|
||||
version = "1.0.0";
|
||||
|
||||
src = ./main.c;
|
||||
|
||||
dontUnpack = true;
|
||||
|
||||
nativeBuildInputs = [ clang cclyzerpp ];
|
||||
|
||||
buildPhase = ''
|
||||
name=`basename ''${src//\.c/}`
|
||||
|
||||
clang -c -emit-llvm $src
|
||||
|
||||
clang $src -o $name
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out/{bin,facts,bitcode}
|
||||
|
||||
${cclyzerpp}/bin/factgen-exe $name.bc --out-dir $out/facts
|
||||
|
||||
mv $name $out/bin
|
||||
mv $name.bc $out/bitcode
|
||||
'';
|
||||
}
|
Loading…
Reference in New Issue
Block a user