1
0
mirror of https://github.com/spacebarchat/client.git synced 2024-11-22 10:22:30 +01:00

Merge pull request #135 from spacebarchat/dev/react/nix

Add nix flake
This commit is contained in:
Puyodead1 2023-04-24 14:15:31 -04:00 committed by GitHub
commit 74ab700573
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 3924 additions and 68 deletions

61
flake.lock Normal file
View File

@ -0,0 +1,61 @@
{
"nodes": {
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1681202837,
"narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "cfacdce06f30d2b68473a46042957675eebb3401",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1682258674,
"narHash": "sha256-nSqXN+dBgw8+DeE3vBhdHB7C2p+2QBDsA27ZptjJz/Y=",
"owner": "lilyinstarlight",
"repo": "nixpkgs",
"rev": "47c77aa566f5114b4d759280702b9b910d3c7f0f",
"type": "github"
},
"original": {
"owner": "lilyinstarlight",
"ref": "unheck/nodejs",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

42
flake.nix Normal file
View File

@ -0,0 +1,42 @@
{
description = "Spacebar client, written in React.";
#inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-22.11";
inputs.flake-utils.url = "github:numtide/flake-utils";
#inputs.pnpm2nix.url = "github:TheArcaneBrony/pnpm2nix";
#inputs.pnpm2nix.url = "path:/home/root@Rory/git/spacebar/client/pnpm2nix";
#inputs.pnpm2nix.flake = false;
inputs.nixpkgs.url = "github:lilyinstarlight/nixpkgs/unheck/nodejs";
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
};
#_pnpm2nix = import pnpm2nix { pkgs = nixpkgs.legacyPackages.${system}; };
in rec {
#packages.default = _pnpm2nix.mkPnpmPackage {
packages.default = pkgs.buildNpmPackage {
pname = "spacebar-client-react";
src = ./.;
name = "spacebar-client-react";
#buildInputs = with pkgs; [ ];
npmDepsHash = "sha256-BAsUdPWJk8/QVaRjOELusOf3TGoft4o90FJ11ef3xJE=";
makeCacheWritable = true;
installPhase = ''
runHook preInstall
cp -r build $out/
runHook postInstall
'';
};
devShell = pkgs.mkShell {
buildInputs = with pkgs; [
nodejs
nodePackages.pnpm
nodePackages.typescript
];
};
}
);
}

42
flake.template.nix Normal file
View File

@ -0,0 +1,42 @@
{
description = "Spacebar client, written in React.";
#inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-22.11";
inputs.flake-utils.url = "github:numtide/flake-utils";
#inputs.pnpm2nix.url = "github:TheArcaneBrony/pnpm2nix";
#inputs.pnpm2nix.url = "path:/home/root@Rory/git/spacebar/client/pnpm2nix";
#inputs.pnpm2nix.flake = false;
inputs.nixpkgs.url = "github:lilyinstarlight/nixpkgs/unheck/nodejs";
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
};
#_pnpm2nix = import pnpm2nix { pkgs = nixpkgs.legacyPackages.${system}; };
in rec {
#packages.default = _pnpm2nix.mkPnpmPackage {
packages.default = pkgs.buildNpmPackage {
pname = "spacebar-client-react";
src = ./.;
name = "spacebar-client-react";
#buildInputs = with pkgs; [ ];
npmDepsHash = "$NPM_HASH";
makeCacheWritable = true;
installPhase = ''
runHook preInstall
cp -r build $out/
runHook postInstall
'';
};
devShell = pkgs.mkShell {
buildInputs = with pkgs; [
nodejs
nodePackages.pnpm
nodePackages.typescript
];
};
}
);
}

3
nix-build-test.sh Executable file
View File

@ -0,0 +1,3 @@
#!/usr/bin/env sh
#nix build --update-input pnpm2nix --debugger --ignore-try
nix build --debugger --ignore-try --print-out-paths --print-build-logs --http2 "$@"

7
nix-rebuild-flake.sh Executable file
View File

@ -0,0 +1,7 @@
#!/usr/bin/env nix-shell
#!nix-shell -i "bash -x" -p nodejs nodePackages.ts-node prefetch-npm-deps bash
rm -rfv package-lock.json
npm i --save --ignore-scripts
DEPS_HASH=`prefetch-npm-deps package-lock.json`
sed 's/$NPM_HASH/'${DEPS_HASH/\//\\\/}'/g' flake.template.nix > flake.nix
#sha256-5iurI8d2mael4qR/gs4IeZpf5d6+QPBoZ+kvhrwoOIU=

3835
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
lockfileVersion: '6.0'
lockfileVersion: '5.4'
dependencies:
'@emotion/react':