Removed pkgs functions
This commit is contained in:
parent
ed48a77b93
commit
3ea3d96020
3 changed files with 2 additions and 31 deletions
36
packages/writeCppScriptBin/default.nix
Normal file
36
packages/writeCppScriptBin/default.nix
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
{
|
||||
stdenv,
|
||||
gcc,
|
||||
writeText,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
{
|
||||
name,
|
||||
code,
|
||||
buildInputs ? [],
|
||||
cxxFlags ? "-std=c++23 -O2 -Wall",
|
||||
}:
|
||||
stdenv.mkDerivation {
|
||||
pname = name;
|
||||
version = "1.0";
|
||||
src = writeText "${name}.cpp" code;
|
||||
inherit buildInputs;
|
||||
nativeBuildInputs = [gcc];
|
||||
|
||||
buildPhase = ''
|
||||
mkdir -p build
|
||||
$CXX ${cxxFlags} -o ${name} $src \
|
||||
${concatStringsSep " " (map (lib: "-I${lib}/include") buildInputs)} \
|
||||
${concatStringsSep " " (map (lib: "-L${lib}/lib") buildInputs)} \
|
||||
${concatStringsSep " " (map (lib: "-l" + builtins.baseNameOf lib) buildInputs)}
|
||||
'';
|
||||
|
||||
dontUnpack = true;
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out/bin
|
||||
cp ${name} $out/bin/
|
||||
'';
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue