63 lines
1.7 KiB
Nix
63 lines
1.7 KiB
Nix
{
|
|
inputs.nixpkgs.url = github:nixOS/nixpkgs/nixos-unstable;
|
|
inputs.flake-utils.url = github:numtide/flake-utils;
|
|
|
|
outputs = { self, nixpkgs, flake-utils, ... }: flake-utils.lib.eachDefaultSystem (system:
|
|
let
|
|
pkgs = import nixpkgs { inherit system; };
|
|
lib = pkgs.lib;
|
|
|
|
esbuild = pkgs.buildGoModule rec {
|
|
pname = "esbuild";
|
|
version = "0.19.5";
|
|
|
|
src = pkgs.fetchFromGitHub {
|
|
owner = "evanw";
|
|
repo = "esbuild";
|
|
rev = "v${version}";
|
|
hash = "sha256-mIXsPj804jxDd8+jPH8tWnnUj7dXIRwfKTeT4WDWb5c=";
|
|
};
|
|
|
|
vendorHash = "sha256-+BfxCyg0KkDQpHt/wycy/8CTG6YBA/VJvJFhhzUnSiQ=";
|
|
|
|
subPackages = [ "cmd/esbuild" ];
|
|
|
|
ldflags = [ "-s" "-w" ];
|
|
|
|
meta.mainProgram = "esbuild";
|
|
};
|
|
in
|
|
rec {
|
|
packages.default = pkgs.buildNpmPackage {
|
|
pname = "dtth-phanpy";
|
|
version = "0.1.0";
|
|
|
|
nativeBuildInputs = with pkgs; [ git ];
|
|
ESBUILD_BINARY_PATH = lib.getExe esbuild;
|
|
|
|
src = lib.cleanSource ./.;
|
|
|
|
npmFlags = [ "--legacy-peer-deps" ];
|
|
npmDepsHash = "sha256-YJwJOTTbypjT7BbGR5VWkKv+T/nAwbsc7s1kV41AGKM=";
|
|
# npmDepsHash = lib.fakeHash;
|
|
|
|
# DTTH-specific env variables
|
|
PHANPY_CLIENT_NAME = "DTTH Phanpy";
|
|
PHANPY_CLIENT_ID = "ch.dtth.phanpy";
|
|
PHANPY_WEBSITE = "https://social.dtth.ch";
|
|
|
|
installPhase = ''
|
|
runHook preInstall
|
|
mkdir -p $out/lib
|
|
cp -r dist $out/lib/phanpy
|
|
runHook postInstall
|
|
'';
|
|
};
|
|
|
|
devShells.default = pkgs.mkShell {
|
|
inputsFrom = [ packages.default ];
|
|
buildInputs = with pkgs; [ nodejs ];
|
|
};
|
|
});
|
|
}
|