104 lines
2.5 KiB
Nix
104 lines
2.5 KiB
Nix
|
{
|
||
|
inputs = {
|
||
|
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||
|
|
||
|
treefmt-nix = {
|
||
|
url = "github:numtide/treefmt-nix";
|
||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||
|
};
|
||
|
};
|
||
|
|
||
|
outputs =
|
||
|
{
|
||
|
self,
|
||
|
nixpkgs,
|
||
|
treefmt-nix,
|
||
|
}:
|
||
|
let
|
||
|
# System types to support.
|
||
|
supportedSystems = [
|
||
|
"x86_64-linux"
|
||
|
"x86_64-darwin"
|
||
|
"aarch64-linux"
|
||
|
"aarch64-darwin"
|
||
|
];
|
||
|
|
||
|
forEachSupportedSystem =
|
||
|
f:
|
||
|
nixpkgs.lib.genAttrs supportedSystems (
|
||
|
system:
|
||
|
f ({
|
||
|
pkgs = import nixpkgs {
|
||
|
inherit system;
|
||
|
overlays = [ self.overlays.default ];
|
||
|
};
|
||
|
})
|
||
|
);
|
||
|
in
|
||
|
{
|
||
|
formatter = forEachSupportedSystem (
|
||
|
{ pkgs, ... }: (treefmt-nix.lib.evalModule pkgs ./treefmt.nix).config.build.wrapper
|
||
|
);
|
||
|
devShells = forEachSupportedSystem (
|
||
|
{ pkgs, ... }:
|
||
|
{
|
||
|
default = pkgs.mkShell {
|
||
|
nativeBuildInputs = with pkgs; [
|
||
|
bun
|
||
|
typescript-language-server
|
||
|
];
|
||
|
};
|
||
|
}
|
||
|
);
|
||
|
packages = forEachSupportedSystem (
|
||
|
{ pkgs, ... }:
|
||
|
{
|
||
|
default = pkgs.wynntils-waypoints;
|
||
|
}
|
||
|
);
|
||
|
overlays.default = final: prev: {
|
||
|
wynntils-waypoints =
|
||
|
with final;
|
||
|
stdenv.mkDerivation (
|
||
|
let
|
||
|
packageJSON = builtins.fromJSON (builtins.readFile ./package.json);
|
||
|
in
|
||
|
{
|
||
|
pname = "wynntils-waypoints";
|
||
|
inherit (packageJSON) version;
|
||
|
|
||
|
meta = {
|
||
|
inherit (packageJSON) description;
|
||
|
platforms = supportedSystems;
|
||
|
license = lib.licensesSpdx.${packageJSON.license};
|
||
|
maintainers = [
|
||
|
packageJSON.author
|
||
|
];
|
||
|
};
|
||
|
|
||
|
nativeBuildInputs = [
|
||
|
bun
|
||
|
];
|
||
|
|
||
|
src = ./.;
|
||
|
|
||
|
buildPhase = ''
|
||
|
bun build ./main.ts --minify --sourcemap --bytecode --compile --outfile wynntils-waypoints
|
||
|
'';
|
||
|
dontStrip = true;
|
||
|
installPhase = ''
|
||
|
mkdir -p $out/bin/
|
||
|
install ./wynntils-waypoints $out/bin/
|
||
|
'';
|
||
|
}
|
||
|
);
|
||
|
};
|
||
|
|
||
|
nixosModules.wynntils-waypoints =
|
||
|
{ pkgs, ... }:
|
||
|
{
|
||
|
nixpkgs.overlays = [ self.overlay ];
|
||
|
};
|
||
|
};
|
||
|
}
|