Skip to content

Commit

Permalink
feat: add devcontainer (#33)
Browse files Browse the repository at this point in the history
* feat: add devcontainer
* feat: add recipes for running images on kubernetes
* feat: add vscode extensions

* fix: disable nixpod check on mergify queue
  • Loading branch information
cameronraysmith authored Sep 13, 2023
1 parent c50171b commit 289374d
Show file tree
Hide file tree
Showing 4 changed files with 90 additions and 2 deletions.
22 changes: 22 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"name": "nixpod-dev",
"build": {
"dockerfile": "../containers/Containerfile.debnix",
"context": ".."
},
"customizations": {
"vscode": {
"extensions": [
"jnoortheen.nix-ide",
"arrterian.nix-env-selector",
"sclu1034.justfile",
"ms-vscode.makefile-tools",
"ms-vsliveshare.vsli",
"eamodio.gitlens",
"github.vscode-github-actions",
"vscode-icons-team.vscode-icons",
"poimandres.theme-poimandres"
]
}
}
}
1 change: 0 additions & 1 deletion .github/mergify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ pull_request_rules:
- check-success=gitguardian
- check-success=nixci
- check-success=debnix
- check-success=nixpod
- base=main
- label!=work-in-progress
actions:
Expand Down
13 changes: 13 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"recommendations": [
"jnoortheen.nix-ide",
"arrterian.nix-env-selector",
"sclu1034.justfile",
"ms-vscode.makefile-tools",
"ms-vsliveshare.vsli",
"eamodio.gitlens",
"github.vscode-github-actions",
"vscode-icons-team.vscode-icons",
"poimandres.theme-poimandres"
]
}
56 changes: 55 additions & 1 deletion justfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ default: help
# Display help
help:
@printf "\nRun 'just -n <command>' to print what would be executed...\n\n"
@just --list
@just --list --unsorted
@echo "\n...by running 'just <command>'.\n"
@echo "This message is printed by 'just help' and just 'just'.\n"

Expand Down Expand Up @@ -71,6 +71,60 @@ container_image := if container_type == "testing" {
}
container_tag := "latest"

architecture := if arch() == "x86_64" {
"amd64"
} else if arch() == "aarch64" {
"arm64"
} else {
error("unsupported architecture must be amd64 or arm64")
}

opsys := if os() == "macos" {
"darwin"
} else if os() == "linux" {
"linux"
} else {
error("unsupported operating system must be darwin or linux")
}

# Install devpod
[unix]
install-devpod:
curl -L -o devpod \
"https://github.com/loft-sh/devpod/releases/latest/download/devpod-{{opsys}}-{{architecture}}" && \
sudo install -c -m 0755 devpod /usr/local/bin && rm -f devpod

# Print devpod info
devpod:
devpod version && echo
devpod context list
devpod provider list
devpod list

# Install and use devpod kubernetes provider
provider:
devpod provider add kubernetes --silent || true \
&& devpod provider use kubernetes

# Run latest container_image in current kube context
pod:
devpod up \
--devcontainer-image {{container_registry}}{{container_image}}:{{container_tag}} \
--provider kubernetes \
--ide vscode \
--open-ide \
--source git:https://github.com/cameronraysmith/nixpod-home \
--provider-option DISK_SIZE=100Gi \
{{container_image}}

# Interactively select devpod to stop
stop:
devpod stop

# Interactively select devpod to delete
delete:
devpod delete

container_command_type := "sysbash"
# If you want to
# **test the flake manually**
Expand Down

0 comments on commit 289374d

Please sign in to comment.