add basic deno flake
This commit is contained in:
parent
d35bd34a70
commit
701e5d138a
5 changed files with 162 additions and 0 deletions
40
package.nix
Normal file
40
package.nix
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
{ pkgs, target, name }:
|
||||
pkgs.stdenv.mkDerivation rec {
|
||||
pname = name;
|
||||
version = "0.1.0";
|
||||
src = ./.;
|
||||
|
||||
__noChroot = true;
|
||||
|
||||
dontStrip = true;
|
||||
|
||||
denort = pkgs.fetchurl {
|
||||
url = "https://dl.deno.land/release/v${pkgs.deno.version}/denort-${target}.zip";
|
||||
hash = "sha256-J2LfvHPbJvcOpbQOd6EmGxHDciez7tG10etK4bqQhLI=";
|
||||
};
|
||||
|
||||
nativeBuildInputs = with pkgs; [ deno unzip ];
|
||||
|
||||
configurePhase = ''
|
||||
export DENO_DIR=./.deno_cache;
|
||||
mkdir -p $TMPDIR/denort
|
||||
pushd $TMPDIR/denort
|
||||
unzip ${denort}
|
||||
chmod +x denort
|
||||
popd
|
||||
'';
|
||||
|
||||
buildPhase = ''
|
||||
runHook preBuild
|
||||
|
||||
export DENORT_BIN="$TMPDIR/denort/denort"
|
||||
|
||||
deno compile --output app main.ts --target=${target}
|
||||
runHook postBuild
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out/bin
|
||||
cp app $out/bin/${name}
|
||||
'';
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue