added stuff

This commit is contained in:
vali 2024-04-09 23:11:33 +02:00
commit 7d4f626b7d
907 changed files with 70990 additions and 0 deletions

3
nyx/flake/templates/node/.gitignore vendored Normal file
View file

@ -0,0 +1,3 @@
result
build
node_modules

View file

@ -0,0 +1,12 @@
{
lib,
buildNpmPackage,
}:
buildNpmPackage {
pname = "foo-bar";
version = "0.1.0";
src = ./.;
npmDepsHash = lib.fakeSha256;
}

View file

@ -0,0 +1,26 @@
{
description = "NodeJS Project Template";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs";
};
outputs = {
self,
nixpkgs,
}: let
systems = ["x86_64-linux" "aarch64-linux"];
forEachSystem = nixpkgs.lib.genAttrs systems;
pkgsForEach = nixpkgs.legacyPackages;
in rec {
packages = forEachSystem (system: {
default = pkgsForEach.${system}.callPackage ./default.nix {};
});
devShells = forEachSystem (system: {
default = pkgsForEach.${system}.callPackage ./shell.nix {};
});
hydraJobs = packages;
};
}

View file

@ -0,0 +1,19 @@
{
"name": "sample-nodejs",
"version": "0.0.1",
"description": "Sample node program",
"bin": {
"sample-node": "build/index.js"
},
"scripts": {
"build": "tsc",
"start": "npm run build && node build/index.js"
},
"author": "NotAShelf",
"license": "MIT",
"devDependencies": {
"@types/node": "^20.1.2",
"typescript": "^5.0.4",
"typescript-language-server": "^3.3.2"
}
}

View file

@ -0,0 +1,24 @@
{
callPackage,
writeShellScriptBin,
eslint_d,
prettierd,
}: let
mainPkg = callPackage ./default.nix {};
mkNpxAlias = name: writeShellScriptBin name "npx ${name} \"$@\"";
in
mainPkg.overrideAttrs (oa: {
nativeBuildInputs =
[
eslint_d
prettierd
(mkNpxAlias "tsc")
(mkNpxAlias "tsserver")
]
++ (oa.nativeBuildInputs or []);
shellHook = ''
eslint_d start # start eslint daemon
eslint_d status # inform user about eslint daemon status
'';
})

View file

@ -0,0 +1 @@
console.log("Hello world!");

View file

@ -0,0 +1,16 @@
{
"compilerOptions": {
"target": "es2016",
"lib": ["es6"],
"module": "commonjs",
"rootDir": "src",
"resolveJsonModule": true,
"allowJs": true,
"outDir": "build",
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"strict": true,
"noImplicitAny": true,
"skipLibCheck": true
}
}