dream2nix/examples/packages/languages/nodejs-local-development-no-lock-file/default.nix
DavHau 42838c5909 examples: cleanup and rename to simplify
- name example more consistently, eg. `{language}-packaging-{feature}` or `{language}-local-development-{feature}`
- move some examples to the modules integration tests directory instead as their purpose was mainly testing and they weren't good example
- module owned checks: import via flake if available
2024-03-09 04:45:59 +00:00

42 lines
738 B
Nix

{
lib,
config,
dream2nix,
...
}: {
imports = [
dream2nix.modules.dream2nix.nodejs-package-json-v3
dream2nix.modules.dream2nix.nodejs-granular-v3
];
deps = {nixpkgs, ...}: {
inherit
(nixpkgs)
gnugrep
stdenv
;
};
nodejs-granular-v3 = {
buildScript = ''
tsc ./app.ts
mv app.js app.js.tmp
echo "#!${config.deps.nodejs}/bin/node" > app.js
cat app.js.tmp >> app.js
chmod +x ./app.js
patchShebangs .
'';
};
name = lib.mkForce "app";
version = lib.mkForce "1.0.0";
mkDerivation = {
src = lib.cleanSource ./.;
checkPhase = ''
./app.js | ${config.deps.gnugrep}/bin/grep -q "Hello, World!"
'';
doCheck = true;
};
}