Improved? battery life + pkgs functions

This commit is contained in:
Aleksandr Lebedev 2025-08-11 23:28:50 +02:00
parent 3d5d222c1d
commit ed48a77b93
7 changed files with 115 additions and 21 deletions

View file

@ -1,11 +1,11 @@
{
custom,
writeCppScriptBin,
lib,
jq,
deploy-rs,
...
}:
custom.writeCppScriptBin {
writeCppScriptBin {
name = "deploy-rs-online";
code = ''
#include <string>

View file

@ -1,36 +0,0 @@
{
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/
'';
}