mirror of
https://github.com/nix-community/dream2nix.git
synced 2024-11-26 22:31:39 +03:00
examples(nodejs): add example nodejs-no-lock
This commit is contained in:
parent
6159824a2a
commit
b38c4d9a2f
2
v1/nix/modules/drvs/nodejs-no-lock/app.ts
Normal file
2
v1/nix/modules/drvs/nodejs-no-lock/app.ts
Normal file
@ -0,0 +1,2 @@
|
||||
let message: string = 'Hello, World!';
|
||||
console.log(message);
|
46
v1/nix/modules/drvs/nodejs-no-lock/default.nix
Normal file
46
v1/nix/modules/drvs/nodejs-no-lock/default.nix
Normal file
@ -0,0 +1,46 @@
|
||||
{
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}: let
|
||||
l = lib // builtins;
|
||||
system = config.deps.stdenv.system;
|
||||
in {
|
||||
imports = [
|
||||
../../drv-parts/nodejs-package-json
|
||||
../../drv-parts/nodejs-granular
|
||||
];
|
||||
|
||||
mkDerivation = {
|
||||
src = lib.cleanSource ./.;
|
||||
checkPhase = ''
|
||||
./app.js | ${config.deps.gnugrep}/bin/grep -q "Hello, World!"
|
||||
'';
|
||||
doCheck = true;
|
||||
};
|
||||
|
||||
nodejs-granular = {
|
||||
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 .
|
||||
'';
|
||||
};
|
||||
|
||||
deps = {nixpkgs, ...}: {
|
||||
inherit
|
||||
(nixpkgs)
|
||||
gnugrep
|
||||
stdenv
|
||||
;
|
||||
};
|
||||
|
||||
name = l.mkForce "app";
|
||||
version = l.mkForce "0.0.0";
|
||||
|
||||
lock.lockFileRel =
|
||||
l.mkForce "/v1/nix/modules/drvs/nodejs-no-lock/lock-${system}.json";
|
||||
}
|
33
v1/nix/modules/drvs/nodejs-no-lock/lock-x86_64-linux.json
Normal file
33
v1/nix/modules/drvs/nodejs-no-lock/lock-x86_64-linux.json
Normal file
@ -0,0 +1,33 @@
|
||||
{
|
||||
"package-lock": {
|
||||
"name": "tmp.BeJiEGlOfL",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"dependencies": {
|
||||
"typescript": "^5.1.6"
|
||||
}
|
||||
},
|
||||
"node_modules/typescript": {
|
||||
"version": "5.1.6",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.1.6.tgz",
|
||||
"integrity": "sha512-zaWCozRZ6DLEWAWFrVDz1H6FVXzUSfTy5FUMWsQlU8Ym5JP9eO4xkTIROFCQvhQf61z6O/G6ugw3SgAnvvm+HA==",
|
||||
"bin": {
|
||||
"tsc": "bin/tsc",
|
||||
"tsserver": "bin/tsserver"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14.17"
|
||||
}
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"typescript": {
|
||||
"version": "5.1.6",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.1.6.tgz",
|
||||
"integrity": "sha512-zaWCozRZ6DLEWAWFrVDz1H6FVXzUSfTy5FUMWsQlU8Ym5JP9eO4xkTIROFCQvhQf61z6O/G6ugw3SgAnvvm+HA=="
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
7
v1/nix/modules/drvs/nodejs-no-lock/package.json
Normal file
7
v1/nix/modules/drvs/nodejs-no-lock/package.json
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"name": "app",
|
||||
"dependencies": {
|
||||
"typescript": "^5.1.6"
|
||||
},
|
||||
"bin": "app.js"
|
||||
}
|
Loading…
Reference in New Issue
Block a user