feat: Enhance NixOS workshop environment with conditional ISO settings and improved local development commands

This commit is contained in:
2025-08-16 14:42:52 +02:00
parent 66c986c8f1
commit 6c32b42f48
3 changed files with 155 additions and 125 deletions

25
ABRA_RECIPES.md Normal file
View File

@@ -0,0 +1,25 @@
| Recipe | Score | Description | Link |
|---|---|---|---|
| gitea | 5 | Self-hosted Git service | [https://recipes.coopcloud.tech/gitea](https://recipes.coopcloud.tech/gitea) |
| mealie | 5 | Recipe manager and meal planner | [https://recipes.coopcloud.tech/mealie](https://recipes.coopcloud.tech/mealie) |
| nextcloud | 5 | A safe home for all your data | [https://recipes.coopcloud.tech/nextcloud](https://recipes.coopcloud.tech/nextcloud) |
| gotosocial | 4 | Fast and friendly Fediverse server | [https://recipes.coopcloud.tech/gotosocial](https://recipes.coopcloud.tech/gotosocial) |
| wordpress | 4 | Create a beautiful website, blog, or app | [https://recipes.coopcloud.tech/wordpress](https://recipes.coopcloud.tech/wordpress) |
| collabora | 3 | Online Office suite | [https://recipes.coopcloud.tech/collabora](https://recipes.coopcloud.tech/collabora) |
| croc | 3 | Easily and securely send things | [https://recipes.coopcloud.tech/croc](https://recipes.coopcloud.tech/croc) |
| custom-php | 3 | Custom PHP application | [https://recipes.coopcloud.tech/custom-php](https://recipes.coopcloud.tech/custom-php) |
| dokuwiki | 3 | A simple to use and highly versatile Open Source wiki software | [https://recipes.coopcloud.tech/dokuwiki](https://recipes.coopcloud.tech/dokuwiki) |
| engelsystem | 3 | Tool for coordinating helpers and shifts | [https://recipes.coopcloud.tech/engelsystem](https://recipes.coopcloud.tech/engelsystem) |
| fab-manager | 3 | FabLab management software | [https://recipes.coopcloud.tech/fab-manager](https://recipes.coopcloud.tech/fab-manager) |
| ghost | 3 | Publishing platform for professional publishers | [https://recipes.coopcloud.tech/ghost](https://recipes.coopcloud.tech/ghost) |
| karrot | 3 | Web application for grassroots initiatives | [https://recipes.coopcloud.tech/karrot](https://recipes.coopcloud.tech/karrot) |
| lauti | 3 | Calendar software for events | [https://recipes.coopcloud.tech/lauti](https://recipes.coopcloud.tech/lauti) |
| loomio | 3 | Collaborative decision-making tool | [https://recipes.coopcloud.tech/loomio](https://recipes.coopcloud.tech/loomio) |
| mattermost | 3 | Secure collaboration platform | [https://recipes.coopcloud.tech/mattermost](https://recipes.coopcloud.tech/mattermost) |
| mattermost-lts | 3 | Long-term support for Mattermost | [https://recipes.coopcloud.tech/mattermost-lts](https://recipes.coopcloud.tech/mattermost-lts) |
| mrbs | 3 | Meeting Room Booking System | [https://recipes.coopcloud.tech/mrbs](https://recipes.coopcloud.tech/mrbs) |
| onlyoffice | 3 | Office suite for documents | [https://recipes.coopcloud.tech/onlyoffice](https://recipes.coopcloud.tech/onlyoffice) |
| open-inventory | 3 | Open source inventory management | [https://recipes.coopcloud.tech/open-inventory](https://recipes.coopcloud.tech/open-inventory) |
| outline | 3 | Team knowledge base | [https://recipes.coopcloud.tech/outline](https://recipes.coopcloud.tech/outline) |
| owncast | 3 | Self-hosted live video streaming | [https://recipes.coopcloud.tech/owncast](https://recipes.coopcloud.tech/owncast) |
| rallly | 3 | Schedule group meetings | [https://recipes.coopcloud.tech/rallly](https://recipes.coopcloud.tech/rallly) |

View File

@@ -1,10 +1,13 @@
{ pkgs, allParticipantNames, ... }: { { pkgs, allParticipantNames, ... }: {
system.stateVersion = "25.05"; system.stateVersion = "25.05";
isoImage.makeEfiBootable = true; # Conditional ISO image settings
isoImage.makeUsbBootable = true; ${pkgs.lib.mkIf isLiveIso {
isoImage.makeEfiBootable = true;
isoImage.makeUsbBootable = true;
}}
networking.wireless.enable = true; networking.wireless.enable = true;
networking.networkmanager.enable = true; networking.networkmanager.enable = true;
networking.hostName = "workshop-live"; networking.hostName = "workshop-live";
@@ -77,136 +80,135 @@
programs.zsh = { programs.zsh = {
enable = true; enable = true;
interactiveShellInit = '' interactiveShellInit = ''
echo "CODE CRISPIES Workshop Environment" echo "CODE CRISPIES Workshop Environment"
echo "Mode: Local Development + Cloud Access" echo "Mode: Local Development + Cloud Access"
echo "" echo ""
echo "🏠 Local Development:" echo "🏠 Local Development:"
echo " recipes - Show available app recipes" echo " recipes - Show available app recipes"
echo " deploy <recipe> - Deploy app locally (e.g., deploy wordpress)" echo " deploy <recipe> - Deploy app locally (e.g., deploy wordpress)"
echo " browser - Launch Firefox" echo " setup-traefik - Setup local Traefik (required first!)"
echo " desktop - Start GUI session" echo " browser - Launch Firefox"
echo "" echo " desktop - Start GUI session"
echo " Cloud Access:" echo ""
echo " Available servers:" echo " Cloud Access:"
${builtins.concatStringsSep "\n" (map (name: echo " Available servers:"
"echo \" - ${name}.codecrispi.es\"" ${builtins.concatStringsSep "\n" (map (name:
) allParticipantNames)} "echo \" - ${name}.codecrispi.es\""
echo " connect <name> - SSH to cloud server" ) cloudServerNames)}
echo "" echo " connect <name> - SSH to cloud server"
echo "📚 Commands: recipes | deploy | connect | browser | desktop | help" echo ""
echo "📚 Commands: setup-traefik | recipes | deploy | connect | browser | desktop | help"
# Ensure abra is in PATH
export PATH="$HOME/.local/bin:$PATH"
# Ensure abra is in PATH deploy() {
export PATH="$HOME/.local/bin:$PATH" if [ -z "$1" ]; then
echo "Usage: deploy <recipe>"
deploy() { echo "Example: deploy wordpress"
if [ -z "$1" ]; then echo "Run 'recipes' to see available options"
echo "Usage: deploy <recipe>" return 1
echo "Example: deploy wordpress" fi
echo "Run 'recipes' to see available options"
return 1
fi
local recipe="$1" local recipe="$1"
local domain="$recipe.workshop.local" local domain="$recipe.workshop.local"
echo "🚀 Deploying $recipe locally..." echo "🚀 Deploying $recipe locally..."
echo "Domain: $domain" echo "Domain: $domain"
# Check if abra is available # Check if abra is available
if ! command -v abra &> /dev/null; then if ! command -v abra &> /dev/null; then
echo " Abra not found. Run 'sudo systemctl restart workshop-abra-setup'" echo " Abra not found. Run 'sudo systemctl restart workshop-abra-setup'"
return 1 return 1
fi fi
# Deploy with abra # Deploy with abra
abra app new "$recipe" -S --domain="$domain" abra app new "$recipe" -S --domain="$domain"
abra app deploy "$domain" abra app deploy "$domain"
echo " Deployed! Access at: http://$domain" echo " Deployed! Access at: http://$domain"
echo "🌐 Open browser with: browser" echo "🌐 Open browser with: browser"
} }
connect() { connect() {
[ -z "$1" ] && { echo "Usage: connect <name>"; return 1; } [ -z "$1" ] && { echo "Usage: connect <name>"; return 1; }
echo "Connecting to $1.codecrispi.es..." echo "Connecting to $1.codecrispi.es..."
ssh -o StrictHostKeyChecking=no workshop@$1.codecrispi.es ssh -o StrictHostKeyChecking=no workshop@$1.codecrispi.es
} }
recipes() { recipes() {
echo "Available Co-op Cloud Recipes:" echo "Available Co-op Cloud Recipes:"
echo "" echo ""
echo "📝 Content Management:" echo "📝 Content Management:"
echo " wordpress ghost hedgedoc dokuwiki mediawiki" echo " wordpress ghost hedgedoc dokuwiki mediawiki"
echo "" echo ""
echo "📁 File & Collaboration:" echo "📁 File & Collaboration:"
echo " nextcloud seafile collabora onlyoffice" echo " nextcloud seafile collabora onlyoffice"
echo "" echo ""
echo "💬 Communication:" echo "💬 Communication:"
echo " jitsi-meet matrix-synapse rocketchat mattermost" echo " jitsi-meet matrix-synapse rocketchat mattermost"
echo "" echo ""
echo "🛒 E-commerce & Business:" echo "🛒 E-commerce & Business:"
echo " prestashop invoiceninja kimai pretix" echo " prestashop invoiceninja kimai pretix"
echo "" echo ""
echo " Development & Tools:" echo " Development & Tools:"
echo " gitea drone n8n gitlab jupyter-lab" echo " gitea drone n8n gitlab jupyter-lab"
echo "" echo ""
echo "📊 Analytics & Monitoring:" echo "📊 Analytics & Monitoring:"
echo " plausible matomo uptime-kuma grafana" echo " plausible matomo uptime-kuma grafana"
echo "" echo ""
echo "🎵 Media & Social:" echo "🎵 Media & Social:"
echo " peertube funkwhale mastodon pixelfed jellyfin" echo " peertube funkwhale mastodon pixelfed jellyfin"
echo "" echo ""
echo "🚀 Local Deploy: deploy <recipe>" echo "🚀 Local Deploy: deploy <recipe>"
echo " Cloud Deploy: connect <server> then use abra commands" echo " Cloud Deploy: connect <server> then use abra commands"
echo "📖 Browse all: https://recipes.coopcloud.tech" echo "📖 Browse all: https://recipes.coopcloud.tech"
} }
browser() { browser() {
echo "🌐 Starting Firefox..." echo "🌐 Starting Firefox..."
if [ -n "$DISPLAY" ]; then if [ -n "$DISPLAY" ]; then
firefox & firefox &
else else
echo " No GUI session. Run 'desktop' first" echo " No GUI session. Run 'desktop' first"
fi fi
} }
desktop() { desktop() {
echo "🖥 Starting GUI session..." echo "🖥 Starting GUI session..."
if [ -z "$DISPLAY" ]; then if [ -z "$DISPLAY" ]; then
startx & startx &
export DISPLAY=:0 export DISPLAY=:0
sleep 3 sleep 3
echo " GUI started. Run 'browser' to open Firefox" echo " GUI started. Run 'browser' to open Firefox"
else else
echo " GUI already running" echo " GUI already running"
fi fi
} }
help() {
echo "CODE CRISPIES Workshop Commands:"
echo ""
echo "🏠 Local Development:"
echo " setup-traefik - Setup local Traefik proxy (required first!)"
echo " recipes - Show all available app recipes"
echo " deploy <recipe> - Deploy app locally (e.g., deploy wordpress)"
echo " browser - Launch Firefox browser"
echo " desktop - Start GUI desktop session"
echo ""
echo " Cloud Access:"
echo " connect <name> - SSH to cloud server (e.g., connect hopper)"
echo ""
echo "Available servers: ${builtins.concatStringsSep " " cloudServerNames}"
echo ""
echo "📚 Learning Flow:"
echo " 1. First time: setup-traefik"
echo " 2. Try local: recipes deploy wordpress browser"
echo " 3. Try cloud: connect hopper same abra commands"
}
help() { export -f setup-traefik deploy connect recipes browser desktop help
echo "CODE CRISPIES Workshop Commands:" '';
echo ""
echo "🏠 Local Development:"
echo " recipes - Show all available app recipes"
echo " deploy <recipe> - Deploy app locally (e.g., deploy wordpress)"
echo " browser - Launch Firefox browser"
echo " desktop - Start GUI desktop session"
echo ""
echo " Cloud Access:"
echo " connect <name> - SSH to cloud server (e.g., connect hopper)"
echo ""
echo "🔧 System:"
echo " sudo nmcli dev wifi connect SSID password PASSWORD"
echo " sudo systemctl restart workshop-abra-setup # Reinstall abra"
echo ""
echo "📚 Learning Flow:"
echo " 1. Try local: recipes deploy wordpress browser"
echo " 2. Try cloud: connect hopper same abra commands"
echo ""
echo "Available servers: ${builtins.concatStringsSep " " allParticipantNames}"
}
export -f deploy connect recipes browser desktop help
'';
}; };
services.xserver = { services.xserver = {

View File

@@ -49,9 +49,9 @@
numParticipants; numParticipants;
# Common configuration for both live-iso and local-vm # Common configuration for both live-iso and local-vm
commonConfig = import ./common.nix { commonConfig =
inherit pkgs allParticipantNames participantNames; { isLiveIso ? false, ... } @ args:
}; import ./common.nix (args // { inherit pkgs allParticipantNames participantNames; });
in in
{ {
packages.${system} = { packages.${system} = {
@@ -63,6 +63,7 @@
modules = [ modules = [
commonConfig commonConfig
{ isLiveIso = true; }
]; ];
}; };
}; };
@@ -79,6 +80,7 @@
inherit system; inherit system;
modules = [ modules = [
commonConfig commonConfig
{ isLiveIso = false; }
({ config, pkgs, ... }: { ({ config, pkgs, ... }: {
boot.loader.grub.enable = false; boot.loader.grub.enable = false;
boot.loader.generic-extlinux-compatible.enable = true; boot.loader.generic-extlinux-compatible.enable = true;
@@ -108,3 +110,4 @@
}; };
}; };
} }