doorbell-matrix-bot/flake.nix

57 lines
1.4 KiB
Nix

{
description = "PVV doorbell matrix bot";
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
outputs = { self, nixpkgs, ... }@inputs: let
forAllSystems = nixpkgs.lib.genAttrs nixpkgs.lib.systems.flakeExposed;
in {
inherit inputs;
packages = forAllSystems (system: let
inherit (pkgs) lib;
pkgs = nixpkgs.legacyPackages.${system};
package-json = lib.importJSON ./package.json;
in {
default = pkgs.stdenv.mkDerivation {
pname = package-json.name;
version = package-json.version;
meta.homepage = package-json.repository.url;
meta.license = lib.getLicenseFromSpdxId package-json.license;
src = lib.fileset.toSource {
root = ./.;
fileset = lib.fileset.difference ./. (lib.fileset.unions [
./module.nix
./flake.lock
./flake.nix
]);
};
nativeBuildInputs = with pkgs; [
importNpmLock.hooks.npmConfigHook
nodejs
# nodejs.passthru.python # for node-gyp
npmHooks.npmBuildHook
npmHooks.npmInstallHook
];
dontNpmBuild = true;
npmDeps = pkgs.importNpmLock {
npmRoot = ./.;
};
};
});
overlays = forAllSystems (system: {
default = prevPackages: finalPackages: {
pvv-doorbell-bot = self.packages.${system}.default;
};
});
nixosModules.default = import ./module.nix;
};
}