feat(apps): add to nixFastBuild and clean up nix code
All checks were successful
Discord / discord commits (push) Has been skipped
All checks were successful
Discord / discord commits (push) Has been skipped
This commit is contained in:
parent
655eac9ad6
commit
a67f0fd422
19 changed files with 67 additions and 46 deletions
|
@ -1,25 +1,31 @@
|
|||
{
|
||||
runtimeInputs,
|
||||
npmDepsHash,
|
||||
src,
|
||||
lib,
|
||||
buildNpmPackage,
|
||||
callPackage,
|
||||
makeWrapper,
|
||||
nodejs_latest,
|
||||
jq,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) concatMapStringsSep getBin;
|
||||
|
||||
packageJSON = builtins.fromJSON (builtins.readFile ./package.json);
|
||||
packageJSON = builtins.fromJSON (builtins.readFile "${src}/package.json");
|
||||
in
|
||||
buildNpmPackage rec {
|
||||
pname = packageJSON.name;
|
||||
inherit (packageJSON) version;
|
||||
|
||||
src = ./.;
|
||||
npmDepsHash = "sha256-5miQfnSy559jVsqyZM5LqegMuIVsd+LOdsZ8FaHy24A=";
|
||||
inherit src runtimeInputs npmDepsHash;
|
||||
|
||||
prePatch = ''
|
||||
mv ./tsconfig.json ./project.json
|
||||
sed 's/^ *\/\/.*//' ${./tsconfig.json} > ./base.json
|
||||
${jq}/bin/jq -sr '.[0] * .[1] | del(.extends)' ./project.json ./base.json > ./tsconfig.json
|
||||
rm base.json project.json
|
||||
'';
|
||||
|
||||
runtimeInputs = [
|
||||
(callPackage ../../nixosModules/docker/updateImage.nix {})
|
||||
];
|
||||
nativeBuildInputs = [makeWrapper];
|
||||
|
||||
postInstall = ''
|
|
@ -3,13 +3,18 @@
|
|||
pkgs,
|
||||
...
|
||||
}: let
|
||||
inherit (pkgs.lib) getExe;
|
||||
inherit (pkgs.lib) getExe listToAttrs nameValuePair;
|
||||
|
||||
buildApp = attrs: (pkgs.callPackage ./buildApp.nix ({} // inputs // attrs));
|
||||
|
||||
mkApp = file: {
|
||||
program = getExe (pkgs.callPackage file ({} // inputs));
|
||||
program = getExe (pkgs.callPackage file ({inherit buildApp;} // inputs));
|
||||
type = "app";
|
||||
};
|
||||
in {
|
||||
extract-subs = mkApp ./extract-subs;
|
||||
updateFlake = mkApp ./update;
|
||||
}
|
||||
|
||||
mkApps = apps: listToAttrs (map (x: nameValuePair x (mkApp ./${x})) apps);
|
||||
in
|
||||
mkApps [
|
||||
"extract-subs"
|
||||
"update-sources"
|
||||
]
|
||||
|
|
|
@ -1,32 +1,13 @@
|
|||
{
|
||||
lib,
|
||||
buildNpmPackage,
|
||||
buildApp,
|
||||
ffmpeg-full,
|
||||
makeWrapper,
|
||||
nodejs_latest,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) concatMapStringsSep getBin;
|
||||
|
||||
packageJSON = builtins.fromJSON (builtins.readFile ./package.json);
|
||||
in
|
||||
buildNpmPackage rec {
|
||||
pname = packageJSON.name;
|
||||
inherit (packageJSON) version;
|
||||
|
||||
}:
|
||||
buildApp {
|
||||
src = ./.;
|
||||
npmDepsHash = "sha256-edIAvY03eA3hqPHjAXz8pq3M5NzekOAYAR4o7j/Wf5Y=";
|
||||
npmDepsHash = "sha256-XflXVdlsTonDHiR70Th/V6KUf4KSvcwnDod2mkz7rHQ=";
|
||||
|
||||
runtimeInputs = [
|
||||
ffmpeg-full
|
||||
];
|
||||
nativeBuildInputs = [makeWrapper];
|
||||
|
||||
postInstall = ''
|
||||
wrapProgram $out/bin/${pname} \
|
||||
--prefix PATH : ${concatMapStringsSep ":" (p: getBin p) runtimeInputs}
|
||||
'';
|
||||
|
||||
nodejs = nodejs_latest;
|
||||
meta.mainProgram = pname;
|
||||
}
|
||||
}
|
||||
|
|
BIN
apps/extract-subs/package-lock.json
generated
BIN
apps/extract-subs/package-lock.json
generated
Binary file not shown.
|
@ -7,14 +7,16 @@
|
|||
"build": "node_ver=$(node -v); esbuild src/app.ts --bundle --platform=node --target=\"node${node_ver:1:2}\" --outfile=out/bin/app.cjs"
|
||||
},
|
||||
"dependencies": {
|
||||
"@types/fluent-ffmpeg": "2.1.27",
|
||||
"fluent-ffmpeg": "2.1.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@eslint/js": "9.14.0",
|
||||
"@stylistic/eslint-plugin": "2.10.1",
|
||||
"@types/fluent-ffmpeg": "2.1.27",
|
||||
"@types/node": "22.9.0",
|
||||
"esbuild": "0.24.0",
|
||||
"eslint": "9.14.0",
|
||||
"eslint-plugin-jsdoc": "50.5.0",
|
||||
"fluent-ffmpeg": "2.1.3",
|
||||
"jiti": "2.4.0",
|
||||
"typescript": "5.6.3",
|
||||
"typescript-eslint": "8.14.0"
|
||||
|
|
13
apps/update-sources/default.nix
Normal file
13
apps/update-sources/default.nix
Normal file
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
buildApp,
|
||||
callPackage,
|
||||
...
|
||||
}:
|
||||
buildApp {
|
||||
src = ./.;
|
||||
npmDepsHash = "sha256-zl/UIwBQqpV89Rvagyq3mQDJxkWM0h1evtKg9TiTdiw=";
|
||||
|
||||
runtimeInputs = [
|
||||
(callPackage ../../nixosModules/docker/updateImage.nix {})
|
||||
];
|
||||
}
|
Binary file not shown.
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "update-flake",
|
||||
"name": "update-sources",
|
||||
"version": "0.0.0",
|
||||
"bin": "out/bin/app.cjs",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"build": "node_ver=$(node -v); esbuild src/app.ts --bundle --platform=node --target=\"node${node_ver:1:2}\" --outfile=out/bin/app.cjs"
|
||||
},
|
||||
"dependencies": {
|
||||
"devDependencies": {
|
||||
"@eslint/js": "9.14.0",
|
||||
"@stylistic/eslint-plugin": "2.10.1",
|
||||
"@types/node": "22.9.0",
|
13
checks/apps.nix
Normal file
13
checks/apps.nix
Normal file
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
pkgs,
|
||||
self,
|
||||
}: let
|
||||
inherit (pkgs.lib) mapAttrs' nameValuePair removeAttrs removeSuffix;
|
||||
in
|
||||
mapAttrs'
|
||||
(name: app:
|
||||
nameValuePair "app-${name}" (pkgs.symlinkJoin {
|
||||
name = "app-${name}";
|
||||
paths = [(removeSuffix "/bin/${name}" (toString app.program))];
|
||||
}))
|
||||
(removeAttrs self.apps.${pkgs.system} ["genflake"])
|
|
@ -2,6 +2,7 @@
|
|||
pkgs,
|
||||
self,
|
||||
}: let
|
||||
apps = import ./apps.nix {inherit pkgs self;};
|
||||
nixosMachines = import ./machines.nix {inherit pkgs self;};
|
||||
in
|
||||
nixosMachines
|
||||
apps // nixosMachines
|
||||
|
|
Loading…
Reference in a new issue