add flake #1

Merged
felixalb merged 1 commits from :flake into main 2024-08-24 18:02:08 +02:00
2 changed files with 68 additions and 0 deletions

27
flake.lock Normal file
View File

@ -0,0 +1,27 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1723637854,
"narHash": "sha256-med8+5DSWa2UnOqtdICndjDAEjxr5D7zaIiK4pn0Q7c=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "c3aa7b8938b17aebd2deecf7be0636000d62a2b9",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

41
flake.nix Normal file
View File

@ -0,0 +1,41 @@
{
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.buildNpmPackage {
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 [
./flake.nix
./flake.lock
]);
};
npmDepsHash = "sha256-UNc902yMkoWfpun1RrLYlEtOXcFd7uxlwKFWoM0/nTE=";
postInstall = ''
ln -vs /run/secrets/pvv-doorbell-config.json $out/lib/node_modules/$pname/config.json
'';
dontNpmBuild = true;
};
});
};
}