nix: initial tooling

Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I5e9bfbc614604329d54240c02f620e156a6a6964
This commit is contained in:
raf 2026-01-21 15:02:50 +03:00
commit 7fe980d27b
Signed by: NotAShelf
GPG key ID: 29D95B64378DB4BF
5 changed files with 102 additions and 0 deletions

1
.envrc Normal file
View file

@ -0,0 +1 @@
use nix

27
flake.lock generated Normal file
View file

@ -0,0 +1,27 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1768886240,
"narHash": "sha256-C2TjvwYZ2VDxYWeqvvJ5XPPp6U7H66zeJlRaErJKoEM=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "80e4adbcf8992d3fd27ad4964fbb84907f9478b0",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

24
flake.nix Normal file
View file

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

43
nix/package.nix Normal file
View file

@ -0,0 +1,43 @@
{
lib,
stdenv,
fetchPnpmDeps,
nodejs-slim,
pnpm,
pnpmConfigHook,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "nix-evaluator-stats";
version = "0.1.0";
src = ../.;
nativeBuildInputs = [
nodejs-slim
pnpm
pnpmConfigHook # dependency resolution
];
pnpmDeps = fetchPnpmDeps {
inherit (finalAttrs) pname src;
hash = "sha256-CpfaUvQbvOXljCqNwyMUJNDisnlrWCHBwhmdIzjmv+c=";
fetcherVersion = 3; # https://nixos.org/manual/nixpkgs/stable/#javascript-pnpm-fetcherVersion
};
buildPhase = ''
runHook preBuild
mkdir -p $out/share/dist
pnpm run build --outDir $out/share/dist
runHook postBuild
'';
meta = {
description = "Pretty visualiser for Nix evaluator stats";
homepage = "https://github.com/notashelf/nix-evaluator-stats";
platforms = ["x86_64-linux" "aarch64-linux"];
license = lib.licenses.mpl20;
maintainers = [lib.maintainers.NotAShelf];
};
})

7
shell.nix Normal file
View file

@ -0,0 +1,7 @@
{pkgs ? import <nixpkgs> {}}:
pkgs.mkShell {
packages = [
pkgs.nodejs-slim
pkgs.pnpm
];
}