commit e99337652d9f3997ce65937abe5fb41c1ec7c22f Author: maurice Date: Sat Oct 25 14:30:39 2025 +0200 initial commit diff --git a/README.md b/README.md new file mode 100644 index 0000000..279be4e --- /dev/null +++ b/README.md @@ -0,0 +1,6 @@ +# PHP +When using VS Code, you need to set `Laravel: PHP path` to +``` +/home/user/.config/herd-lite/bin/php +``` +Else it won't work. \ No newline at end of file diff --git a/base.Containerfile b/base.Containerfile new file mode 100644 index 0000000..a598c58 --- /dev/null +++ b/base.Containerfile @@ -0,0 +1,24 @@ +FROM alpine:latest + +RUN apk update && apk add --no-cache \ + git openssh helix bash bash-completion go curl \ + helix-tree-sitter-vendor + +# tree-sitter-yaml, tree-sitter-caddy + +RUN adduser -D -u 1000 -s /bin/bash user + +# Compile host-spawn +COPY scripts/build-host-spawn.sh . +RUN chmod +x build-host-spawn.sh +RUN ./build-host-spawn.sh + +# Allow Podman host access +RUN ln -s /usr/local/bin/spawn /usr/local/bin/podman + +# Config files +COPY config/ /home/user/ +RUN chown -R user:user /home/user + +WORKDIR /home/user +VOLUME /home/user \ No newline at end of file diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..1fd6634 --- /dev/null +++ b/build.sh @@ -0,0 +1,18 @@ +#!/bin/sh +set -e + +# Check if a name argument was provided +if [ -z "$1" ]; then + echo "Usage: $0 " + exit 1 +fi + +containerfile="$1.Containerfile" + +# Check if the containerfile exists +if [ ! -f "$containerfile" ]; then + echo "Error: Containerfile '$containerfile' not found." + exit 1 +fi + +podman build -t "devc-$1" -f $containerfile \ No newline at end of file diff --git a/config/.bashrc b/config/.bashrc new file mode 100644 index 0000000..56e8702 --- /dev/null +++ b/config/.bashrc @@ -0,0 +1 @@ +export COLORTERM=truecolor diff --git a/config/.config/helix/config.toml b/config/.config/helix/config.toml new file mode 100644 index 0000000..85eb19d --- /dev/null +++ b/config/.config/helix/config.toml @@ -0,0 +1,4 @@ +theme = "dark_plus" + +[editor.file-picker] +hidden = false \ No newline at end of file diff --git a/config/.config/helix/languages.toml b/config/.config/helix/languages.toml new file mode 100644 index 0000000..9eca1d0 --- /dev/null +++ b/config/.config/helix/languages.toml @@ -0,0 +1,69 @@ +# C# +[language-server.omnisharp] +command = "/home/user/.omnisharp/OmniSharp" +args = [ "--languageserver" ] + +# Rust +[language-server.rust-analyzer.config.check] +command = "clippy" + +[[language]] +name = "rust" +formatter = { command = "rustfmt" } + +# Deno +[[language]] +name = "javascript" +shebangs = ["deno"] +roots = ["deno.json", "deno.jsonc"] +file-types = ["js"] +language-servers = ["deno-lsp"] +auto-format = true + +[[language]] +name = "typescript" +shebangs = ["deno"] +roots = ["deno.json", "deno.jsonc"] +file-types = ["ts"] +language-servers = ["deno-lsp"] +auto-format = true + +[[language]] +name = "jsx" +shebangs = ["deno"] +roots = ["deno.json", "deno.jsonc"] +file-types = ["jsx"] +language-servers = ["deno-lsp"] +auto-format = true + +[[language]] +name = "tsx" +shebangs = ["deno"] +roots = ["deno.json", "deno.jsonc"] +file-types = ["tsx"] +language-servers = ["deno-lsp"] +auto-format = true + +[language-server.deno-lsp] +command = "deno" +args = ["lsp"] +environment = { NO_COLOR = "1" } + +[language-server.deno-lsp.config.deno] +enable = true +## Uncomment to enable completion of unstable features of Deno +## unstable = true +## Uncomment to cache dependencies on save +## cacheOnSave = true +## Enable completion of importing from registries +## Enable completion of function calls +suggest = { completeFunctionCalls = false, imports = { hosts = { "https://deno.land" = true } } } +## suggest = { imports = { hosts = { "https://deno.land" = true, "https://crux.land" = true, "https://x.nest.land" = true } } } +## Uncomment to enable inlay hints +## inlayHints.parameterNames.enabled = "all" +## inlayHints.parameterTypes.enabled = true +## inlayHints.variableTypes.enabled = true +## inlayHints.propertyDeclarationTypes.enabled = true +## inlayHints.functionLikeReturnTypes.enabled = true +## inlayHints.enumMemberValues.enabled = true + diff --git a/enter.sh b/enter.sh new file mode 100755 index 0000000..6eafeda --- /dev/null +++ b/enter.sh @@ -0,0 +1,30 @@ +#!/bin/sh + +# Check if a name argument was provided +if [ -z "$1" ]; then + echo "Usage: $0 " + exit 1 +fi + +name="devc-$1" +command="/bin/bash" + +# When container is not running or arguments are provided, +# recreate it. +if [ "$(podman container inspect "$name" -f {{.State.Running}} 2>&1)" != 'true' ]; then + echo "starting devcontainer..." + podman container rm -f -t 0 "$name" 1>/dev/null + podman run \ + --security-opt label=disable \ + --userns=keep-id \ + --name $name \ + -e HOST_HOME=$HOME \ + -e SSH_AUTH_SOCK='/tmp/ssh.sock' \ + -v /run/user/$UID/bus:/tmp/dbus.sock \ + -v /run/user/$UID/keyring/ssh:/tmp/ssh.sock \ + -v $HOME/Dev:/home/user/dev \ + -v v-$name:/home/user:copy \ + --rm -td $name +fi + +podman exec --detach-keys "ctrl-@" -it "$name" ${command:-} diff --git a/fullstack.Containerfile b/fullstack.Containerfile new file mode 100644 index 0000000..2c41003 --- /dev/null +++ b/fullstack.Containerfile @@ -0,0 +1,9 @@ +FROM localhost/devc-web-base + +RUN apk add --no-cache \ + dotnet9-sdk + +COPY scripts/install-roslyn.sh /tmp/install-roslyn.sh +RUN chmod +x /tmp/install-roslyn.sh && /tmp/install-roslyn.sh + +USER user \ No newline at end of file diff --git a/php.Containerfile b/php.Containerfile new file mode 100644 index 0000000..8bdd637 --- /dev/null +++ b/php.Containerfile @@ -0,0 +1,4 @@ +FROM localhost/devc-web-base + +USER user +RUN /bin/bash -c "$(curl -fsSL https://php.new/install/linux/8.4)" \ No newline at end of file diff --git a/rust.Containerfile b/rust.Containerfile new file mode 100644 index 0000000..3a50849 --- /dev/null +++ b/rust.Containerfile @@ -0,0 +1,6 @@ +FROM localhost/devc-base + +RUN su -c "curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y" user +RUN su -c ". '/home/user/.cargo/env' && rustup component add rust-analyzer" user + +USER user \ No newline at end of file diff --git a/scripts/build-host-spawn.sh b/scripts/build-host-spawn.sh new file mode 100644 index 0000000..d71270d --- /dev/null +++ b/scripts/build-host-spawn.sh @@ -0,0 +1,18 @@ +#!/bin/bash +mkdir /tmp/build +cd /tmp/build +git clone https://github.com/1player/host-spawn.git +cd host-spawn +chmod +x build.sh +./build.sh $(uname -m) +cd build +mv host-spawn* /usr/local/bin/host-spawn +rm -rf /tmp/build + +cat << EOF > /usr/local/bin/spawn +#!/bin/bash +export DBUS_SESSION_BUS_ADDRESS='unix:path=/tmp/dbus.sock' +host-spawn -cwd "\${PWD/#\$HOME/\$HOST_HOME}" \ + $([ "$(basename "\$0")" != "spawn" ] && echo "\$(basename "\$0")") "\$@" +EOF +chmod +x /usr/local/bin/spawn \ No newline at end of file diff --git a/scripts/install-roslyn.sh b/scripts/install-roslyn.sh new file mode 100644 index 0000000..565abb0 --- /dev/null +++ b/scripts/install-roslyn.sh @@ -0,0 +1,9 @@ +#!/bin/bash +version="v1.39.15-beta.60" +arch="linux-musl-x64" +link="https://github.com/OmniSharp/omnisharp-roslyn/releases/download/$version/omnisharp-$arch-net6.0.tar.gz" + +wget -O /tmp/omnisharp.tar.gz $link +mkdir /home/user/.omnisharp +tar -zxf /tmp/omnisharp.tar.gz -C /home/user/.omnisharp/ +chown -R user:user /home/user/.omnisharp \ No newline at end of file diff --git a/web-base.Containerfile b/web-base.Containerfile new file mode 100644 index 0000000..8137973 --- /dev/null +++ b/web-base.Containerfile @@ -0,0 +1,7 @@ +FROM localhost/devc-base + +RUN apk add --no-cache \ + deno pnpm + +RUN su -c "pnpm setup && . /home/user/.bashrc && pnpm i -g bash-language-server vscode-langservers-extracted dockerfile-language-server-nodejs \ + typescript typescript-language-server" user \ No newline at end of file