Last active
January 6, 2025 09:15
-
-
Save perguth/93dead8fbb5e93069fe9826fd17828ba to your computer and use it in GitHub Desktop.
Deno (Fresh) IDX starter, `.idx/dev.nix`
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# To learn more about how to use Nix to configure your environment | |
# see: https://developers.google.com/idx/guides/customize-idx-env | |
{ pkgs, ... }: { | |
# Which nixpkgs channel to use. | |
channel = "stable-24.05"; # or "unstable" | |
# Use https://search.nixos.org/packages to find packages | |
packages = [ | |
pkgs.nano | |
]; | |
# Sets environment variables in the workspace | |
env = {}; | |
idx = { | |
# Search for the extensions you want on https://open-vsx.org/ and use "publisher.id" | |
extensions = [ | |
"denoland.vscode-deno" | |
"bradlc.vscode-tailwindcss" | |
]; | |
# Enable previews | |
previews = { | |
enable = true; | |
previews = { | |
web = { | |
# Example: run "npm run dev" with PORT set to IDX's defined port for previews, | |
# and show it in IDX's web preview panel | |
command = ["/home/user/.deno/bin/deno" "run" "start"]; | |
manager = "web"; | |
env = { | |
# Environment variables to set for your server | |
PORT = "$PORT"; | |
}; | |
}; | |
}; | |
}; | |
# Workspace lifecycle hooks | |
workspace = { | |
# Runs when a workspace is first created | |
onCreate = { | |
deno-install = '' | |
mkdir -p $HOME/.deno/bin | |
curl -fsSL -o $HOME/.deno/deno.zip "https://github.com/denoland/deno/releases/download/v2.0.0/deno-x86_64-unknown-linux-gnu.zip" | |
unzip -o $HOME/.deno/deno.zip -d $HOME/.deno/bin | |
chmod +x $HOME/.deno/bin/deno | |
echo 'export PATH="$PATH:$HOME/.deno/bin"' >> ~/.bashrc | |
rm $HOME/.deno/deno.zip | |
source ~/.bashrc | |
''; | |
}; | |
# Runs when the workspace is (re)started | |
onStart = { | |
}; | |
}; | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
CTRL + Shift+ P
and select:deno run -A -r https://fresh.deno.dev .