Files
Greg ShuflinandClaude Sonnet 4.6 44080b1e84 Migrate from mkYarnPackage to fetchYarnDeps + yarnConfigHook
yarn2nix and mkYarnPackage were removed from nixpkgs; replace with
stdenv.mkDerivation using the new fetchYarnDeps offline cache and
yarnConfigHook.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-02 04:49:35 -07:00

58 lines
1.4 KiB
Nix

{
description = "Spazer - Web Graphics Project";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
in
{
packages.default = pkgs.stdenv.mkDerivation {
name = "spazer";
src = ./.;
offlineCache = pkgs.fetchYarnDeps {
yarnLock = ./yarn.lock;
hash = "sha256-dqgDWYSp4XII7rryZ7uH5cLnZkmKewz6XyxzZzRujC4=";
};
nativeBuildInputs = with pkgs; [
nodejs
yarn
yarnConfigHook
];
buildPhase = ''
export HOME=$(mktemp -d)
yarn build
'';
installPhase = ''
mkdir -p $out
cp -r dist/. $out/
'';
};
# Development shell with required dependencies
devShell = pkgs.mkShell {
buildInputs = with pkgs; [
nodejs
yarn
python3
];
};
# Add a simple app that can serve the built files
apps.default = flake-utils.lib.mkApp {
drv = pkgs.writeShellScriptBin "serve-spazer" ''
${pkgs.python3}/bin/python3 -m http.server --directory ${self.packages.${system}.default} 8080
'';
};
});
}