ip-checker/flake.nix

56 lines
1.5 KiB
Nix

{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-utils = {
url = "github:numtide/flake-utils";
inputs.systems.follows = "systems";
};
treefmt-nix = {
url = "github:numtide/treefmt-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
### De-dupe flake dependencies
systems.url = "github:nix-systems/default";
};
outputs =
inputs:
inputs.flake-utils.lib.eachDefaultSystem (
system:
let
inherit (pkgs) lib;
pkgs = inputs.nixpkgs.legacyPackages.${system};
treefmtEval = inputs.treefmt-nix.lib.evalModule pkgs ./treefmt.nix;
in
{
### nix {run,shell,build}
packages = rec {
default = lib.warn "the 'default' package is now deprecated, please use the 'api' package instead." api;
inherit ((pkgs.callPackage ./package.nix { })) api ui;
};
### nix fmt
formatter = treefmtEval.config.build.wrapper;
### nix flake check
checks.formatting = treefmtEval.config.build.check inputs.self;
### nix develop
devShells.default = pkgs.mkShellNoCC {
nativeBuildInputs = with pkgs; [
go
nodePackages.prettier
nodejs
pnpm
];
shellHook = ''
export IP_CHECKER_CITY_DB=${pkgs.dbip-city-lite.mmdb}
export IP_CHECKER_ASN_DB=${pkgs.dbip-asn-lite.mmdb}
export IP_CHECKER_MODE=dev
'';
};
}
);
}