run successfully local deploy
This commit is contained in:
49
flake.nix
49
flake.nix
@@ -25,7 +25,6 @@
|
||||
format = "iso";
|
||||
modules = [
|
||||
({ pkgs, ... }: {
|
||||
# WiFi and NetworkManager
|
||||
networking.networkmanager.enable = true;
|
||||
systemd.services.workshop-wifi = {
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
@@ -35,42 +34,45 @@
|
||||
'';
|
||||
};
|
||||
|
||||
# Auto-login and shell setup
|
||||
services.getty.autologinUser = "workshop";
|
||||
users.users.workshop = {
|
||||
isNormalUser = true;
|
||||
shell = pkgs.zsh;
|
||||
};
|
||||
|
||||
# Zsh shell with helper functions
|
||||
programs.zsh = {
|
||||
enable = true;
|
||||
interactiveShellInit = ''
|
||||
echo "🍪 CODE CRISPIES Workshop Environment"
|
||||
echo "📶 WiFi: CODE_CRISPIES_GUEST (auto-connecting...)"
|
||||
echo "📡 Available servers:"
|
||||
${builtins.concatStringsSep "\n" (map (name:
|
||||
"echo \" - ${name}.codecrispi.es\""
|
||||
) participantNames)}
|
||||
${builtins.concatStringsSep "\n" (map (name: "echo \" - ${name}.codecrispi.es\"") participantNames)}
|
||||
echo ""
|
||||
echo "💡 Commands: connect <name> | recipes | help"
|
||||
|
||||
connect() {
|
||||
[ -z "$1" ] && { echo "Usage: connect <name>"; return 1; }
|
||||
echo "🔗 Connecting to $1.codecrispi.es..."
|
||||
ssh -o StrictHostKeyChecking=no workshop@$1.codecrispi.es
|
||||
}
|
||||
# ... other helper functions (recipes, help) ...
|
||||
|
||||
recipes() {
|
||||
echo "🍪 Featured Co-op Cloud Recipes: (wordpress, nextcloud, hedgedoc...)"
|
||||
echo "Browse all 100+ recipes: https://recipes.coopcloud.tech"
|
||||
}
|
||||
|
||||
help() {
|
||||
echo "💡 Commands: connect <name> | recipes | help"
|
||||
}
|
||||
'';
|
||||
};
|
||||
|
||||
# Base packages and auto-start terminal
|
||||
environment.systemPackages = with pkgs; [ openssh curl git networkmanager ];
|
||||
services.xserver = {
|
||||
enable = true;
|
||||
displayManager.autoLogin = {
|
||||
enable = true;
|
||||
user = "workshop";
|
||||
};
|
||||
desktopManager.xfce.enable = true; # A lightweight desktop
|
||||
displayManager.autoLogin.enable = true;
|
||||
displayManager.autoLogin.user = "workshop";
|
||||
desktopManager.xfce.enable = true;
|
||||
displayManager.sessionCommands = "${pkgs.xfce.xfce4-terminal}/bin/xfce4-terminal &";
|
||||
};
|
||||
})
|
||||
@@ -79,13 +81,26 @@
|
||||
|
||||
# --------------------------------------------------------------------------------
|
||||
# 2. LOCAL DEVELOPMENT ENVIRONMENT (NixOS Containers)
|
||||
# `sudo nixos-rebuild switch --flake .#workshop-local`
|
||||
# `make local-deploy`
|
||||
# --------------------------------------------------------------------------------
|
||||
nixosConfigurations.workshop-local = nixpkgs.lib.nixosSystem {
|
||||
inherit system;
|
||||
modules = [
|
||||
({ pkgs, ... }: {
|
||||
# Define 15 participant containers
|
||||
# Dynamically import the configuration for the current host machine.
|
||||
(
|
||||
let
|
||||
# Read the hostname and remove the trailing newline.
|
||||
hostname = builtins.replaceStrings [ "\n" ] [ "" ] (builtins.readFile "/etc/hostname");
|
||||
in
|
||||
# Build the correct path to the configuration file.
|
||||
/etc/nixos/hosts/${hostname}/configuration.nix
|
||||
)
|
||||
|
||||
# Your container definitions are then added on top of the host config.
|
||||
({ pkgs, config, ... }: {
|
||||
# Set this to your host's NixOS version (e.g., "23.11", "24.05")
|
||||
system.stateVersion = "25.05";
|
||||
|
||||
containers = builtins.listToAttrs (map (i:
|
||||
let
|
||||
participantNum = toString i;
|
||||
@@ -99,7 +114,7 @@
|
||||
hostAddress = "192.168.100.1";
|
||||
localAddress = ipAddr;
|
||||
config = {
|
||||
# Container config from your local/flake.nix
|
||||
system.stateVersion = "24.05";
|
||||
virtualisation.docker.enable = true;
|
||||
environment.systemPackages = with pkgs; [ docker git curl ];
|
||||
services.openssh.enable = true;
|
||||
|
||||
Reference in New Issue
Block a user