Init
This commit is contained in:
commit
53d3703f95
14 files changed
+707
No files matched your search
@@ -0,0 +1,68 @@
|
||||
{
|
||||
description = "Simple vanilla web dev shell: VSCodium + HTML/JS extensions + Python http.server";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs }:
|
||||
let
|
||||
systems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
|
||||
forAllSystems = f: nixpkgs.lib.genAttrs systems (system: f nixpkgs.legacyPackages.${system});
|
||||
in
|
||||
{
|
||||
devShells = forAllSystems (pkgs:
|
||||
let
|
||||
lib = pkgs.lib;
|
||||
|
||||
# Extensions as attribute paths under pkgs.vscode-extensions.
|
||||
# Any that don't exist in your nixpkgs revision are silently skipped
|
||||
# instead of breaking the whole shell.
|
||||
wanted = [
|
||||
[ "esbenp" "prettier-vscode" ] # formatter
|
||||
[ "dbaeumer" "vscode-eslint" ] # JS linting
|
||||
[ "ritwickdey" "liveserver" ] # live reload server
|
||||
[ "formulahendry" "auto-rename-tag" ] # rename paired HTML tags
|
||||
[ "formulahendry" "auto-close-tag" ] # auto-close HTML tags
|
||||
[ "christian-kohler" "path-intellisense" ] # file path autocomplete
|
||||
[ "usernamehw" "errorlens" ] # inline error messages
|
||||
[ "editorconfig" "editorconfig" ] # .editorconfig support
|
||||
[ "bradlc" "vscode-tailwindcss" ] # harmless if unused
|
||||
[ "ms-python" "python" ] # Python support
|
||||
[ "continue" "continue" ] # local line-completion
|
||||
];
|
||||
|
||||
extensions = lib.filter (e: e != null)
|
||||
(map (path: lib.attrByPath path null pkgs.vscode-extensions) wanted);
|
||||
|
||||
codium = pkgs.vscode-with-extensions.override {
|
||||
vscode = pkgs.vscodium;
|
||||
vscodeExtensions = extensions;
|
||||
};
|
||||
in
|
||||
{
|
||||
default = pkgs.mkShell {
|
||||
name = "web-dev";
|
||||
|
||||
packages = [
|
||||
codium
|
||||
pkgs.python3 # `python -m http.server` for static serving
|
||||
pkgs.nodejs # optional: npm, eslint, prettier CLIs, etc.
|
||||
];
|
||||
|
||||
shellHook = ''
|
||||
# Serve current directory: `serve` or `serve 3000`
|
||||
serve() {
|
||||
local port="''${1:-8000}"
|
||||
echo "Serving $(pwd) at http://localhost:$port"
|
||||
python3 -m http.server "$port"
|
||||
}
|
||||
|
||||
echo "Web dev shell ready."
|
||||
echo " codium . - open the editor in this directory"
|
||||
echo " serve [p] - start a static server (default port 8000)"
|
||||
'';
|
||||
};
|
||||
});
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user