Skip to content

Commit

Permalink
:poo: BROKEN: start making a nix package
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaelsgirao committed Aug 24, 2023
1 parent 5d0dea8 commit 725b9ac
Show file tree
Hide file tree
Showing 5 changed files with 2,703 additions and 49 deletions.
225 changes: 217 additions & 8 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

58 changes: 37 additions & 21 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

inputs = {
nixpkgs.url = "flake:nixpkgs";
devenv.url = "github:cachix/devenv";
devenv.url = "github:cachix/devenv";
};

outputs = inputs@{ flake-parts, ... }:
Expand All @@ -13,7 +13,7 @@
# 1. Add foo to inputs
# 2. Add foo as a parameter to the outputs function
# 3. Add here: foo.flakeModule
inputs.devenv.flakeModule
inputs.devenv.flakeModule

];
systems = [ "x86_64-linux" "aarch64-linux" "aarch64-darwin" "x86_64-darwin" ];
Expand All @@ -25,28 +25,44 @@
# Equivalent to inputs'.nixpkgs.legacyPackages.hello;
# packages.default = pkgs.hello;
# packages.default = pkgs.callPackage ./default.nix;
packages.default = pkgs.buildNpmPackage rec {
pname = "ist-discord-bot";
version = "1.0.0";
src = ./.;
npmDepsHash = "sha256-tuEfyePwlOy2/mOPdXbqJskO6IowvAP4DWg8xSZwbJw=";

packages.default = pkgs.mkYarnPackage {
src = ./.;
preBuild = ''
# somehow for linux, npm is not finding the prisma package with the
# packages installed with the lockfile.
# This generates a prisma version incompatibility warning and is a kludge
# until the upstream package-lock is modified.
${pkgs.nodePackages.prisma}/bin/prisma generate
'';
installPhase = ''
runHook preInstall
mkdir $out
cp -r $src/* $out/
runHook postInstall
'';
};


devenv.shells.default = {
packages = with pkgs.nodePackages; [
pkgs.nodejs_18
pkgs.yarn
prettier
prisma
];
env = {
PRISMA_MIGRATION_ENGINE_BINARY="${prisma-engines}/bin/migration-engine";
PRISMA_QUERY_ENGINE_BINARY="${prisma-engines}/bin/query-engine";
PRISMA_QUERY_ENGINE_LIBRARY="${prisma-engines}/lib/libquery_engine.node";
PRISMA_INTROSPECTION_ENGINE_BINARY="${prisma-engines}/bin/introspection-engine";
PRISMA_FMT_BINARY="${prisma-engines}/bin/prisma-fmt";
};
packages = with pkgs.nodePackages; [
pkgs.nodejs_18
pkgs.yarn
pkgs.yarn2nix
prettier
prisma
typescript
];

env = with pkgs; {
PRISMA_MIGRATION_ENGINE_BINARY = "${prisma-engines}/bin/migration-engine";
PRISMA_QUERY_ENGINE_BINARY = "${prisma-engines}/bin/query-engine";
PRISMA_QUERY_ENGINE_LIBRARY = "${prisma-engines}/lib/libquery_engine.node";
PRISMA_INTROSPECTION_ENGINE_BINARY = "${prisma-engines}/bin/introspection-engine";
PRISMA_FMT_BINARY = "${prisma-engines}/bin/prisma-fmt";
};
dotenv.enable = true;
};
};
flake = {
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
},
"dependencies": {
"@discordjs/rest": "^1.6.0",
"@prisma/client": "4.11.0",
"@prisma/client": "4.13.0",
"@types/better-sqlite3": "^5.4.3",
"axios": "^0.27.2",
"cheerio": "1.0.0-rc.10",
Expand All @@ -45,7 +45,7 @@
"lint-staged": "^11.0.0",
"pino-pretty": "^9.1.0",
"prettier": "^2.3.2",
"prisma": "4.11.0",
"prisma": "4.13.0",
"typescript": "^4.8.3"
},
"scripts": {
Expand Down
Loading

0 comments on commit 725b9ac

Please sign in to comment.