Skip to content

Commit

Permalink
support nix users
Browse files Browse the repository at this point in the history
  • Loading branch information
cody-dot-js committed Jul 15, 2024
1 parent af11650 commit 1d71bef
Show file tree
Hide file tree
Showing 3 changed files with 114 additions and 14 deletions.
33 changes: 19 additions & 14 deletions .envrc
Original file line number Diff line number Diff line change
@@ -1,20 +1,25 @@
# Check if nvm is installed, install if not
if [ ! -d "$NVM_DIR" ] || [ ! -s "$NVM_DIR/nvm.sh" ]; then
echo "nvm is not installed. Installing nvm..."

# Install nvm
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
fi
# if using nixos, run `use flake`
if has nix; then
use flake
else
# Check if nvm is installed, install if not
if [ ! -d "$NVM_DIR" ] || [ ! -s "$NVM_DIR/nvm.sh" ]; then
echo "nvm is not installed. Installing nvm..."

# Install nvm
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
fi

# ensure nvm is in the path
export NVM_DIR="$HOME/.nvm"
export PATH="$NVM_DIR:$PATH"
# ensure nvm is in the path
export NVM_DIR="$HOME/.nvm"
export PATH="$NVM_DIR:$PATH"

# load nvm
\. $NVM_DIR/nvm.sh
# load nvm
\. $NVM_DIR/nvm.sh

# install node version from .nvmrc
nvm install
# install node version from .nvmrc
nvm install
fi

# enable pnpm in corepack
corepack enable pnpm
Expand Down
61 changes: 61 additions & 0 deletions flake.lock

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

34 changes: 34 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
description = "ngrok docs";

inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";

flake-utils = {
url = "github:numtide/flake-utils";
inputs.nixpkgs.follows = "nixpkgs";
};
};

outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
};
node-toolchain = with pkgs; [
nodejs
nodePackages.pnpm
];
in
{
devShell = pkgs.mkShell {
shellHook = ''
export PATH="$PATH:$(git rev-parse --show-toplevel)/node_modules/.bin"
'';
buildInputs = with pkgs; [
node-toolchain
];
};
});
}

0 comments on commit 1d71bef

Please sign in to comment.