diff --git a/.envrc b/.envrc index a8a7606..d4b93ce 100644 --- a/.envrc +++ b/.envrc @@ -1 +1,2 @@ +use flake layout node diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..d765e11 --- /dev/null +++ b/flake.lock @@ -0,0 +1,57 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 0, + "narHash": "sha256-Tbk1MZbtV2s5aG+iM99U8FqwxU/YNArMcWAv6clcsBc=", + "path": "/nix/store/l9nb64iii15y0nr37qrs1cfm6rlpg6gh-source", + "type": "path" + }, + "original": { + "id": "nixpkgs", + "type": "indirect" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs", + "utils": "utils" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..ca74dc1 --- /dev/null +++ b/flake.nix @@ -0,0 +1,21 @@ +{ + inputs = { + utils.url = "github:numtide/flake-utils"; + }; + outputs = { self, nixpkgs, utils }: utils.lib.eachDefaultSystem (system: + let + pkgs = nixpkgs.legacyPackages.${system}; + in + { + devShell = pkgs.mkShell { + buildInputs = with pkgs; [ + nodejs + ]; + }; + packages = rec { + default = shows-api; + shows-api = pkgs.callPackage ./package.nix {}; + }; + } + ); +} diff --git a/package.nix b/package.nix new file mode 100644 index 0000000..02eb203 --- /dev/null +++ b/package.nix @@ -0,0 +1,29 @@ +{ + lib, + buildNpmPackage, + nodejs, +}: +buildNpmPackage { + name = "shows-api"; + version = "1.0"; + + src = builtins.fetchGit { + url = "https://git.everest.tailscale/Toast/shows-api"; + rev = "82e1a6258fc7704395233c23c79050204dbd1992"; + }; + + npmDepsHash = "sha256-iNib7GPvbpTexhRsq24TXoW0jlIox1IcA3wmE0BQcJM="; + + installPhase = '' + runHook preInstall + + npm config delete cache + npm prune + + mkdir -p $out + mv package.json package-lock.json node_modules dist $out + + makeWrapper ${lib.getExe nodejs} $out/bin/shows-api \ + --add-flags $out/dist/main --chdir $out + ''; +}