Package with a flake.nix

main
Yorick van Pelt 2023-04-18 18:22:00 +02:00
parent 90e0274ff2
commit fa14c5c2ed
Signed by: yorick
GPG Key ID: A36E70F9DC014A15
6 changed files with 83 additions and 3 deletions

3
.gitignore vendored
View File

@ -3,4 +3,5 @@
/lib/
/marvin/
/marvin-*/
/node_modules
/node_modules
/result

2
.yarnignore Normal file
View File

@ -0,0 +1,2 @@
yarn-cache
src/*

2
bin/marvin-timesync.js Executable file
View File

@ -0,0 +1,2 @@
#!/usr/bin/env node
import "../lib/index.js"

45
flake.lock Normal file
View File

@ -0,0 +1,45 @@
{
"nodes": {
"nix-npm-buildpackage": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1677562139,
"narHash": "sha256-J39FdMjECbWGSXVHmEdyGBD2aRYGhg9bWEPf1/ZR47k=",
"owner": "serokell",
"repo": "nix-npm-buildpackage",
"rev": "d45296118cae672982f192451dd3e19fa6c2d068",
"type": "github"
},
"original": {
"owner": "serokell",
"repo": "nix-npm-buildpackage",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1673796341,
"narHash": "sha256-1kZi9OkukpNmOaPY7S5/+SlCDOuYnP3HkXHvNDyLQcc=",
"path": "/nix/store/lzgxbh8c61phbh074y2707l2yw6vvaa1-source",
"rev": "6dccdc458512abce8d19f74195bb20fdb067df50",
"type": "path"
},
"original": {
"id": "nixpkgs",
"type": "indirect"
}
},
"root": {
"inputs": {
"nix-npm-buildpackage": "nix-npm-buildpackage",
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

20
flake.nix Normal file
View File

@ -0,0 +1,20 @@
{
inputs.nix-npm-buildpackage.url = "github:serokell/nix-npm-buildpackage";
inputs.nix-npm-buildpackage.inputs.nixpkgs.follows = "nixpkgs";
outputs = { self, nixpkgs, nix-npm-buildpackage }: {
devShells.x86_64-linux.default = nixpkgs.legacyPackages.x86_64-linux.mkShell {
buildInputs = with nixpkgs.legacyPackages.x86_64-linux; [
yarn
nodePackages.typescript-language-server
];
};
packages.x86_64-linux.default = nix-npm-buildpackage.legacyPackages.x86_64-linux.buildYarnPackage {
src = ./.;
postBuild = ''
yarn install --production --ignore-scripts --prefer-offline
'';
postInstall = "rm $out/bin/yarn";
meta.mainProgram = "marvin-timesync";
};
};
}

View File

@ -1,9 +1,12 @@
{
"name": "timesync",
"name": "marvin-timesync",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"type": "module",
"bin": {
"marvin-timesync": "./bin/marvin-timesync.js"
},
"dependencies": {
"@tsconfig/node18": "^1.0.2",
"@types/luxon": "^3.3.0",
@ -16,5 +19,12 @@
"pouchdb-find": "^8.0.1",
"typescript": "^5.0.4",
"xdg-basedir": "^5.1.0"
}
},
"scripts": {
"watch": "exec tsc --noEmit -w",
"start": "exec tsx ./src/index.ts",
"test": "echo \"Error: no test specified\" && exit 1",
"prepare": "exec tsc"
},
"private": true
}