make default.nix a function callable by callPackage

main
Daniel Barlow 2022-09-16 18:18:37 +01:00
parent 63232841cd
commit a36876194d
2 changed files with 10 additions and 4 deletions

1
build.nix Normal file
View File

@ -0,0 +1 @@
with import <nixpkgs> {} ; callPackage ./. { }

View File

@ -1,4 +1,9 @@
with import <nixpkgs> {};
{
lua5_3
, stdenv
, fennel
, makeWrapper
}:
let lua = lua5_3.withPackages (ps: [
ps.dkjson
ps.lpeg
@ -6,7 +11,7 @@ let lua = lua5_3.withPackages (ps: [
ps.luaposix
]);
inherit makeWrapper;
fennel = pkgs.fennel.override { inherit lua; };
myfennel = fennel.override { inherit lua; };
in stdenv.mkDerivation {
pname = "grafana-sms-alert";
version = "0.1";
@ -16,9 +21,9 @@ in stdenv.mkDerivation {
lua_path="`lua -e 'print(package.path)'`"
lua_cpath="`lua -e 'print(package.cpath)'`"
makeWrapper ${fennel}/bin/fennel $out/bin/grafana-sms-alert \
makeWrapper ${myfennel}/bin/fennel $out/bin/grafana-sms-alert \
--add-flags "$out/lib/main.fnl"
'';
buildInputs = [lua fennel];
buildInputs = [lua myfennel];
nativeBuildInputs = [ makeWrapper ];
}