tracks lexicons and how many times they appeared on the jetstream

build(nix): drop nci, separate packages

ptr.pet 9bab265d 73978e71

verified
+1 -264
flake.lock
···
{
"nodes": {
-
"crane": {
-
"flake": false,
-
"locked": {
-
"lastModified": 1727316705,
-
"narHash": "sha256-/mumx8AQ5xFuCJqxCIOFCHTVlxHkMT21idpbgbm/TIE=",
-
"owner": "ipetkov",
-
"repo": "crane",
-
"rev": "5b03654ce046b5167e7b0bccbd8244cb56c16f0e",
-
"type": "github"
-
},
-
"original": {
-
"owner": "ipetkov",
-
"ref": "v0.19.0",
-
"repo": "crane",
-
"type": "github"
-
}
-
},
-
"dream2nix": {
-
"inputs": {
-
"nixpkgs": [
-
"nci",
-
"nixpkgs"
-
],
-
"purescript-overlay": "purescript-overlay",
-
"pyproject-nix": "pyproject-nix"
-
},
-
"locked": {
-
"lastModified": 1752547840,
-
"narHash": "sha256-T6wYez5urMcY8oUetwOIqPcqj77Ey3qka7wQsi6YCd4=",
-
"owner": "nix-community",
-
"repo": "dream2nix",
-
"rev": "667ba5ee25c95cf63ace92307db270e235dce66e",
-
"type": "github"
-
},
-
"original": {
-
"owner": "nix-community",
-
"repo": "dream2nix",
-
"type": "github"
-
}
-
},
-
"flake-compat": {
-
"flake": false,
-
"locked": {
-
"lastModified": 1696426674,
-
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
-
"owner": "edolstra",
-
"repo": "flake-compat",
-
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
-
"type": "github"
-
},
-
"original": {
-
"owner": "edolstra",
-
"repo": "flake-compat",
-
"type": "github"
-
}
-
},
-
"mk-naked-shell": {
-
"flake": false,
-
"locked": {
-
"lastModified": 1681286841,
-
"narHash": "sha256-3XlJrwlR0nBiREnuogoa5i1b4+w/XPe0z8bbrJASw0g=",
-
"owner": "yusdacra",
-
"repo": "mk-naked-shell",
-
"rev": "7612f828dd6f22b7fb332cc69440e839d7ffe6bd",
-
"type": "github"
-
},
-
"original": {
-
"owner": "yusdacra",
-
"repo": "mk-naked-shell",
-
"type": "github"
-
}
-
},
-
"naked-shell": {
-
"locked": {
-
"lastModified": 1681286841,
-
"narHash": "sha256-3XlJrwlR0nBiREnuogoa5i1b4+w/XPe0z8bbrJASw0g=",
-
"owner": "90-008",
-
"repo": "mk-naked-shell",
-
"rev": "7612f828dd6f22b7fb332cc69440e839d7ffe6bd",
-
"type": "github"
-
},
-
"original": {
-
"owner": "90-008",
-
"repo": "mk-naked-shell",
-
"type": "github"
-
}
-
},
-
"nci": {
-
"inputs": {
-
"crane": "crane",
-
"dream2nix": "dream2nix",
-
"mk-naked-shell": "mk-naked-shell",
-
"nixpkgs": [
-
"nixpkgs"
-
],
-
"parts": "parts",
-
"rust-overlay": "rust-overlay",
-
"treefmt": "treefmt"
-
},
-
"locked": {
-
"lastModified": 1752905922,
-
"narHash": "sha256-fhwoEa+rjxLsRANRqh4jl4evnGpVNTLWUf4a/KDkQ3k=",
-
"owner": "yusdacra",
-
"repo": "nix-cargo-integration",
-
"rev": "47e02f590e1e2c72b4ffc2bcf92b2b11c3195395",
-
"type": "github"
-
},
-
"original": {
-
"owner": "yusdacra",
-
"repo": "nix-cargo-integration",
-
"type": "github"
-
}
-
},
"nixpkgs": {
"locked": {
"lastModified": 1752687322,
···
},
"parts": {
"inputs": {
-
"nixpkgs-lib": [
-
"nci",
-
"nixpkgs"
-
]
-
},
-
"locked": {
-
"lastModified": 1751413152,
-
"narHash": "sha256-Tyw1RjYEsp5scoigs1384gIg6e0GoBVjms4aXFfRssQ=",
-
"owner": "hercules-ci",
-
"repo": "flake-parts",
-
"rev": "77826244401ea9de6e3bac47c2db46005e1f30b5",
-
"type": "github"
-
},
-
"original": {
-
"owner": "hercules-ci",
-
"repo": "flake-parts",
-
"type": "github"
-
}
-
},
-
"parts_2": {
-
"inputs": {
"nixpkgs-lib": "nixpkgs-lib"
},
"locked": {
···
"type": "github"
}
},
-
"purescript-overlay": {
-
"inputs": {
-
"flake-compat": "flake-compat",
-
"nixpkgs": [
-
"nci",
-
"dream2nix",
-
"nixpkgs"
-
],
-
"slimlock": "slimlock"
-
},
-
"locked": {
-
"lastModified": 1728546539,
-
"narHash": "sha256-Sws7w0tlnjD+Bjck1nv29NjC5DbL6nH5auL9Ex9Iz2A=",
-
"owner": "thomashoneyman",
-
"repo": "purescript-overlay",
-
"rev": "4ad4c15d07bd899d7346b331f377606631eb0ee4",
-
"type": "github"
-
},
-
"original": {
-
"owner": "thomashoneyman",
-
"repo": "purescript-overlay",
-
"type": "github"
-
}
-
},
-
"pyproject-nix": {
-
"inputs": {
-
"nixpkgs": [
-
"nci",
-
"dream2nix",
-
"nixpkgs"
-
]
-
},
-
"locked": {
-
"lastModified": 1752481895,
-
"narHash": "sha256-luVj97hIMpCbwhx3hWiRwjP2YvljWy8FM+4W9njDhLA=",
-
"owner": "pyproject-nix",
-
"repo": "pyproject.nix",
-
"rev": "16ee295c25107a94e59a7fc7f2e5322851781162",
-
"type": "github"
-
},
-
"original": {
-
"owner": "pyproject-nix",
-
"repo": "pyproject.nix",
-
"type": "github"
-
}
-
},
"root": {
"inputs": {
-
"naked-shell": "naked-shell",
-
"nci": "nci",
"nixpkgs": "nixpkgs",
-
"parts": "parts_2",
-
"systems": "systems"
-
}
-
},
-
"rust-overlay": {
-
"inputs": {
-
"nixpkgs": [
-
"nci",
-
"nixpkgs"
-
]
-
},
-
"locked": {
-
"lastModified": 1752892850,
-
"narHash": "sha256-LLvDqLiK2+dr7bQqKTnZIZ8F1H67DLt3FUyVrGolGVw=",
-
"owner": "oxalica",
-
"repo": "rust-overlay",
-
"rev": "742248f12aed0183a124637e8b27a238a47f46a2",
-
"type": "github"
-
},
-
"original": {
-
"owner": "oxalica",
-
"repo": "rust-overlay",
-
"type": "github"
-
}
-
},
-
"slimlock": {
-
"inputs": {
-
"nixpkgs": [
-
"nci",
-
"dream2nix",
-
"purescript-overlay",
-
"nixpkgs"
-
]
-
},
-
"locked": {
-
"lastModified": 1688756706,
-
"narHash": "sha256-xzkkMv3neJJJ89zo3o2ojp7nFeaZc2G0fYwNXNJRFlo=",
-
"owner": "thomashoneyman",
-
"repo": "slimlock",
-
"rev": "cf72723f59e2340d24881fd7bf61cb113b4c407c",
-
"type": "github"
-
},
-
"original": {
-
"owner": "thomashoneyman",
-
"repo": "slimlock",
-
"type": "github"
-
}
-
},
-
"systems": {
-
"locked": {
-
"lastModified": 1680978846,
-
"narHash": "sha256-Gtqg8b/v49BFDpDetjclCYXm8mAnTrUzR0JnE2nv5aw=",
-
"owner": "nix-systems",
-
"repo": "x86_64-linux",
-
"rev": "2ecfcac5e15790ba6ce360ceccddb15ad16d08a8",
-
"type": "github"
-
},
-
"original": {
-
"owner": "nix-systems",
-
"repo": "x86_64-linux",
-
"type": "github"
-
}
-
},
-
"treefmt": {
-
"inputs": {
-
"nixpkgs": [
-
"nci",
-
"nixpkgs"
-
]
-
},
-
"locked": {
-
"lastModified": 1752055615,
-
"narHash": "sha256-19m7P4O/Aw/6+CzncWMAJu89JaKeMh3aMle1CNQSIwM=",
-
"owner": "numtide",
-
"repo": "treefmt-nix",
-
"rev": "c9d477b5d5bd7f26adddd3f96cfd6a904768d4f9",
-
"type": "github"
-
},
-
"original": {
-
"owner": "numtide",
-
"repo": "treefmt-nix",
-
"type": "github"
+
"parts": "parts"
}
}
},
+7 -74
flake.nix
···
{
inputs.parts.url = "github:hercules-ci/flake-parts";
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
-
inputs.systems.url = "github:nix-systems/x86_64-linux";
-
inputs.naked-shell.url = "github:90-008/mk-naked-shell";
-
inputs.nci.url = "github:yusdacra/nix-cargo-integration";
-
inputs.nci.inputs.nixpkgs.follows = "nixpkgs";
outputs = inp:
inp.parts.lib.mkFlake {inputs = inp;} {
-
systems = import inp.systems;
-
imports = [
-
inp.naked-shell.flakeModule
-
inp.nci.flakeModule
-
];
+
systems = ["x86_64-linux"];
perSystem = {
+
pkgs,
config,
-
system,
...
-
}: let
-
pkgs = inp.nixpkgs.legacyPackages.${system};
-
packageJson = builtins.fromJSON (builtins.readFile ./client/package.json);
-
in {
-
nci.projects."nsid-tracker" = {
-
export = false;
-
path = ./server;
+
}: {
+
packages.client-modules = pkgs.callPackage ./nix/client-modules.nix { };
+
packages.client = pkgs.callPackage ./nix/client.nix {
+
inherit (config.packages) client-modules;
};
-
packages.client-modules = pkgs.stdenv.mkDerivation {
-
pname = "${packageJson.name}-modules";
-
version = packageJson.version;
-
-
src = ./client;
-
-
outputHash = "sha256-TzTafbNTng/mMyf0yR9Rc6XS9/zzipwmK9SUWm2XxeY=";
-
outputHashAlgo = "sha256";
-
outputHashMode = "recursive";
-
-
nativeBuildInputs = with pkgs; [bun];
-
-
dontConfigure = true;
-
-
buildPhase = "bun install --no-cache --no-progress --frozen-lockfile";
-
installPhase = ''
-
mkdir -p $out
-
-
# Do not copy .cache or .bin
-
cp -R ./node_modules/* $out
-
cp -R ./node_modules/.bin $out
-
ls -la $out
-
'';
-
dontFixup = true;
-
dontPatchShebangs = true;
-
};
-
packages.client = pkgs.stdenv.mkDerivation {
-
pname = packageJson.name;
-
version = packageJson.version;
-
-
src = ./client;
-
-
nativeBuildInputs = [pkgs.makeBinaryWrapper];
-
buildInputs = [pkgs.bun];
-
-
# dontConfigure = true;
-
configurePhase = ''
-
runHook preConfigure
-
cp -R --no-preserve=ownership ${config.packages.client-modules} node_modules
-
find node_modules -type d -exec chmod 755 {} \;
-
substituteInPlace node_modules/.bin/vite \
-
--replace-fail "/usr/bin/env node" "${pkgs.bun}/bin/bun"
-
runHook postConfigure
-
'';
-
buildPhase = ''
-
runHook preBuild
-
bun --prefer-offline run --bun build
-
runHook postBuild
-
'';
-
installPhase = ''
-
runHook preInstall
-
mkdir -p $out
-
cp -R ./build/* $out
-
runHook postInstall
-
'';
-
};
-
packages.server = config.nci.outputs."server".packages.release;
+
packages.server = pkgs.callPackage ./nix/server.nix { };
};
};
}
+31
nix/client-modules.nix
···
+
{
+
stdenv,
+
bun,
+
}:
+
stdenv.mkDerivation {
+
pname = "client-modules";
+
version = "main";
+
+
src = ../client;
+
+
outputHash = "sha256-TzTafbNTng/mMyf0yR9Rc6XS9/zzipwmK9SUWm2XxeY=";
+
outputHashAlgo = "sha256";
+
outputHashMode = "recursive";
+
+
nativeBuildInputs = [bun];
+
+
dontCheck = true;
+
dontConfigure = true;
+
dontFixup = true;
+
dontPatchShebangs = true;
+
+
buildPhase = "bun install --no-cache --no-progress --frozen-lockfile";
+
installPhase = ''
+
mkdir -p $out
+
+
# Do not copy .cache or .bin
+
cp -R ./node_modules/* $out
+
cp -R ./node_modules/.bin $out
+
ls -la $out
+
'';
+
}
+40
nix/client.nix
···
+
{
+
stdenv,
+
makeBinaryWrapper,
+
bun,
+
client-modules,
+
PUBLIC_API_URL ? "http://localhost:3713",
+
}:
+
stdenv.mkDerivation {
+
pname = "client";
+
version = "main";
+
+
src = ../client;
+
+
inherit PUBLIC_API_URL;
+
+
nativeBuildInputs = [makeBinaryWrapper];
+
buildInputs = [bun];
+
+
dontCheck = true;
+
+
configurePhase = ''
+
runHook preConfigure
+
cp -R --no-preserve=ownership ${client-modules} node_modules
+
find node_modules -type d -exec chmod 755 {} \;
+
substituteInPlace node_modules/.bin/vite \
+
--replace-fail "/usr/bin/env node" "${bun}/bin/bun --bun"
+
runHook postConfigure
+
'';
+
buildPhase = ''
+
runHook preBuild
+
bun --prefer-offline run --bun build
+
runHook postBuild
+
'';
+
installPhase = ''
+
runHook preInstall
+
mkdir -p $out
+
cp -R ./build/* $out
+
runHook postInstall
+
'';
+
}
+12
nix/server.nix
···
+
{
+
rustPlatform,
+
...
+
}:
+
rustPlatform.buildRustPackage {
+
pname = "nsid-tracker-server";
+
version = "main";
+
+
src = ../server;
+
+
cargoLock.lockFile = ../server/Cargo.lock;
+
}