framework on devShells?

pull/4/head
pegasust 2022-12-31 01:40:26 -07:00
parent 4d5e06667b
commit 7000b86d38
3 changed files with 62 additions and 0 deletions

View File

@ -77,6 +77,11 @@ in
vimAlias = true;
withPython3 = true;
withNodeJs = true;
# Attempt 4: Correct way to make neovim aware of packages
# homeConfigurations.config.programs.neovim takes UNWRAPPED neovim
# and wraps it.
# Ideally, we build our own neovim and add that to config.home.packages
# to share it with nixOS. But we don't really need to share
extraPackages = nvim_pkgs;
# only for here for archive-documentation
# extraPython3Packages = (pypkgs: [

View File

@ -12,4 +12,8 @@
path = ./rust-monorepo;
description = "Opinionated Rust monorepo, extended from ./rust, using Cargo workspace";
};
ts-turborepo = {
path = ./ts/turborepo;
description = "Typescript monorepo with tsconfig, eslint, but with minimal framework attached";
};
}

View File

@ -0,0 +1,53 @@
{
description = "Provides devShell for Nodejs + pnpm";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
# https://github.com/vercel/turbo/issues/2293#issuecomment-1296094236
# work-around for turbo-repo on nix
turbo.url = "github:dlip/turbo";
};
outputs = { self, turbo, flake-utils, nixpkgs }:
with flake-utils; lib.eachSystem lib.defaultSystems (sys:
let
overlays = [ turbo.overlay ];
# pkgs is our tweaked nixpkgs
pkgs = import nixpkgs { system = sys; overlays = overlays; };
shellMsg = ''
echo "Hello from nix ${sys}"
echo "Local development may use our remote planetscale database (pscale login && pnpm dev:infra; pnpm dev)"
echo "Or from the specified docker-compose.yml (pnpm dev:local_infra && pnpm dev)"
echo "See more on CONTRIBUTING.md"
'';
in
{
devShell = pkgs.mkShell {
nativeBuildInputs = [ pkgs.bashInteractive ];
buildInputs = [
pkgs.nodejs-18_x
pkgs.nodePackages.pnpm
pkgs.nodePackages.prisma
pkgs.prisma-engines
pkgs.turbo
# pkgs.turbo-tooling
pkgs.jq
pkgs.pscale
pkgs.act # Github workflow
];
shellHook =
# https://github.com/prisma/prisma/issues/3026#issuecomment-927258138
# nix-direnv is required (impure build?) https://github.com/nix-community/nix-direnv
''
export PRISMA_MIGRATION_ENGINE_BINARY="${pkgs.prisma-engines}/bin/migration-engine"
export PRISMA_QUERY_ENGINE_BINARY="${pkgs.prisma-engines}/bin/query-engine"
export PRISMA_QUERY_ENGINE_LIBRARY="${pkgs.prisma-engines}/lib/libquery_engine.node"
export PRISMA_INTROSPECTION_ENGINE_BINARY="${pkgs.prisma-engines}/bin/introspection-engine"
export PRISMA_FMT_BINARY="${pkgs.prisma-engines}/bin/prisma-fmt"
export TURBO_BINARY_PATH="${pkgs.turbo}/bin/turbo"
pnpm install
'' + shellMsg;
};
});
}