-
Notifications
You must be signed in to change notification settings - Fork 0
feat: ini iso #1471
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: ini iso #1471
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -105,6 +105,7 @@ tags | |
| result | ||
| result-* | ||
| ref | ||
| *.iso | ||
|
|
||
| .direnv/ | ||
| .env | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -638,6 +638,57 @@ nix-setup-offline: ## Set up offline environment. | |
|
|
||
| ##@ Named Hosts Specific Targets | ||
|
|
||
| .PHONY: build-vm | ||
| build-vm: ## Build a named host VM launcher (set HOST=<name>, e.g. make build-vm HOST=viper). | ||
| @host="$(HOST)"; \ | ||
| if [ -z "$$host" ]; then \ | ||
| host="$(DETECTED_HOST)"; \ | ||
| fi; \ | ||
| if [ -z "$$host" ]; then \ | ||
| echo "❌ No HOST specified and no named host auto-detected"; \ | ||
| exit 1; \ | ||
| fi; \ | ||
| echo "🏗️ Building VM for $$host"; \ | ||
| $(NIX_ALLOW_UNFREE) $(NIX_EXEC) build .#nixosConfigurations.$$host.config.system.build.vm $(NIX_FLAGS) --impure --show-trace | ||
|
|
||
| .PHONY: run-vm | ||
| run-vm: ## Run a named host VM launcher (set HOST=<name>, e.g. make run-vm HOST=viper). | ||
| @host="$(HOST)"; \ | ||
| if [ -z "$$host" ]; then \ | ||
| host="$(DETECTED_HOST)"; \ | ||
| fi; \ | ||
| if [ -z "$$host" ]; then \ | ||
| echo "❌ No HOST specified and no named host auto-detected"; \ | ||
| exit 1; \ | ||
| fi; \ | ||
| $(MAKE) build-vm HOST="$$host"; \ | ||
| script=$$(find ./result/bin -maxdepth 1 -type f \( -name 'run-*-vm' -o -name 'run-nixos-vm' \) | head -n 1); \ | ||
|
Comment on lines
+664
to
+665
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The use of |
||
| if [ -z "$$script" ]; then \ | ||
| echo "❌ Could not find a VM launcher under ./result/bin"; \ | ||
| exit 1; \ | ||
| fi; \ | ||
| "$$script" | ||
|
|
||
| .PHONY: build-iso | ||
| build-iso: ## Build a named host live/install ISO and copy it to ./<host>.iso (set HOST=<name>, e.g. make build-iso HOST=viper). | ||
| @host="$(HOST)"; \ | ||
| if [ -z "$$host" ]; then \ | ||
| host="$(DETECTED_HOST)"; \ | ||
| fi; \ | ||
| if [ -z "$$host" ]; then \ | ||
| echo "❌ No HOST specified and no named host auto-detected"; \ | ||
| exit 1; \ | ||
| fi; \ | ||
| echo "💿 Building ISO for $$host"; \ | ||
| $(NIX_ALLOW_UNFREE) $(NIX_EXEC) build .#nixosConfigurations.$$host"Iso".config.system.build.isoImage $(NIX_FLAGS) --impure --show-trace; \ | ||
| iso_path=$$(find ./result -type f -name '*.iso' | head -n 1); \ | ||
|
Comment on lines
+683
to
+684
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Using |
||
| if [ -z "$$iso_path" ]; then \ | ||
| echo "❌ Could not find a built ISO under ./result"; \ | ||
| exit 1; \ | ||
| fi; \ | ||
| cp -f "$$iso_path" "./$$host.iso"; \ | ||
| echo "✅ Copied $$iso_path to ./$$host.iso" | ||
|
|
||
| .PHONY: switch-% | ||
| switch-%: ## Switch to a named host configuration (e.g., make switch-galactica). | ||
| @$(MAKE) nix-switch HOST=$* | ||
|
|
@@ -1151,4 +1202,3 @@ gt-status: ## Show Gas Town health and Dolt server status. | |
| .PHONY: gt-dolt-status | ||
| gt-dolt-status: ## Show Dolt server status and latency. | ||
| @gt dolt status | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -134,6 +134,18 @@ | |
| inherit inputs; | ||
| username = "skakinoki"; | ||
| }; | ||
| maticIso = import ./named-hosts/matic/iso.nix { | ||
| inherit inputs; | ||
| username = "skakinoki"; | ||
| }; | ||
| viper = import ./named-hosts/viper { | ||
| inherit inputs; | ||
| username = "shunkakinoki"; | ||
| }; | ||
| viperIso = import ./named-hosts/viper/iso.nix { | ||
| inherit inputs; | ||
| username = "shunkakinoki"; | ||
| }; | ||
|
Comment on lines
+137
to
+148
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Username inconsistency between The Also note the username difference between hosts:
If this is intentional (different hosts for different users), no action needed. If 🤖 Prompt for AI Agents |
||
| }; | ||
| homeConfigurations = { | ||
| "ubuntu@x86_64-linux" = import ./hosts/linux { | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -12,8 +12,9 @@ priority="${3:-0}" | |||||
|
|
||||||
| [[ -z $message ]] && exit 0 | ||||||
|
|
||||||
| # Source credentials if not already set | ||||||
| if [[ -z ${PUSHOVER_API_TOKEN:-} ]] || [[ -z ${PUSHOVER_USER_KEY:-} ]]; then | ||||||
| # Source credentials only when the vars are unset. Explicitly blank values | ||||||
| # should disable notifications instead of falling back to ~/.env. | ||||||
| if [[ -z ${PUSHOVER_API_TOKEN+x} ]] || [[ -z ${PUSHOVER_USER_KEY+x} ]]; then | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2: This fallback still loads Prompt for AI agents
Suggested change
|
||||||
| if [[ -f "$HOME/dotfiles/.env" ]]; then | ||||||
| set -a | ||||||
| # shellcheck source=/dev/null | ||||||
|
|
@@ -35,4 +36,4 @@ curl -s \ | |||||
| --form-string "message=${message}" \ | ||||||
| --form-string "priority=${priority}" \ | ||||||
| --form-string "title=${title}" \ | ||||||
| https://api.pushover.net/1/messages.json >/dev/null 2>&1 | ||||||
| https://api.pushover.net/1/messages.json >/dev/null 2>&1 || exit 0 | ||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| { | ||
| inputs, | ||
| username, | ||
| ... | ||
| }: | ||
| let | ||
| system = "x86_64-linux"; | ||
| nixpkgsConfig = import ../../lib/nixpkgs-config.nix { | ||
| nixpkgsLib = inputs.nixpkgs.lib; | ||
| }; | ||
| overlays = import ../../overlays { inherit inputs; }; | ||
| pkgs = import inputs.nixpkgs { | ||
| inherit system overlays; | ||
| config = nixpkgsConfig; | ||
| }; | ||
| in | ||
| inputs.nixpkgs.lib.nixosSystem { | ||
| inherit system; | ||
| specialArgs = { | ||
| inherit inputs username; | ||
| }; | ||
| modules = [ | ||
| (import ../shared/live-iso.nix { | ||
| inherit inputs pkgs username; | ||
| hostname = "matic"; | ||
| userInitialPassword = "changemeow"; | ||
| }) | ||
| ]; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| { | ||
| inputs, | ||
| pkgs, | ||
| username, | ||
| hostname, | ||
| userExtraGroups ? [ ], | ||
| userInitialPassword ? "changemeow", | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P0: Do not ship this base module with a known default password; it creates a trivial path to root on fresh installs. Prompt for AI agents |
||
| stateVersion ? "24.11", | ||
| }: | ||
| { lib, ... }: | ||
| { | ||
| networking.hostName = hostname; | ||
| networking.networkmanager.enable = true; | ||
|
|
||
| programs.fish.enable = true; | ||
|
|
||
| users.users.${username} = { | ||
| isNormalUser = true; | ||
| extraGroups = [ | ||
| "wheel" | ||
| "networkmanager" | ||
| ] | ||
| ++ userExtraGroups; | ||
| home = "/home/${username}"; | ||
| shell = pkgs.fish; | ||
| initialPassword = userInitialPassword; | ||
| }; | ||
|
|
||
| security.sudo.wheelNeedsPassword = false; | ||
|
|
||
| nix = { | ||
| channel.enable = false; | ||
| settings = { | ||
| nix-path = lib.mkForce "nixpkgs=/etc/nix/inputs/nixpkgs"; | ||
| trusted-users = [ | ||
| username | ||
| "@wheel" | ||
| "root" | ||
| ]; | ||
| }; | ||
| }; | ||
|
|
||
| environment.etc."nix/inputs/nixpkgs".source = "${inputs.nixpkgs}"; | ||
|
|
||
| system.stateVersion = stateVersion; | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| { | ||
| inputs, | ||
| pkgs, | ||
| username, | ||
| hostname, | ||
| userInitialPassword, | ||
| isoName ? "${hostname}.iso", | ||
| }: | ||
| { lib, ... }: | ||
| { | ||
| imports = [ | ||
| "${inputs.nixpkgs}/nixos/modules/installer/cd-dvd/installation-cd-minimal.nix" | ||
| "${inputs.nixpkgs}/nixos/modules/installer/cd-dvd/channel.nix" | ||
| (import ./linux-base.nix { | ||
| inherit | ||
| inputs | ||
| pkgs | ||
| username | ||
| hostname | ||
| userInitialPassword | ||
| ; | ||
| }) | ||
| ]; | ||
|
|
||
| environment.systemPackages = with pkgs; [ | ||
| curl | ||
| git | ||
| vim | ||
| ]; | ||
|
|
||
| image.fileName = isoName; | ||
| services.getty.helpLine = lib.mkForce ""; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| { | ||
| inputs, | ||
| username, | ||
| ... | ||
| }: | ||
| let | ||
| system = "x86_64-linux"; | ||
| nixpkgsConfig = import ../../lib/nixpkgs-config.nix { | ||
| nixpkgsLib = inputs.nixpkgs.lib; | ||
| }; | ||
| overlays = import ../../overlays { inherit inputs; }; | ||
| pkgs = import inputs.nixpkgs { | ||
| inherit system overlays; | ||
| config = nixpkgsConfig; | ||
| }; | ||
| in | ||
| inputs.nixpkgs.lib.nixosSystem { | ||
| inherit system; | ||
| specialArgs = { | ||
| inherit inputs username; | ||
| }; | ||
| modules = [ | ||
| (import ../shared/linux-base.nix { | ||
| inherit inputs pkgs username; | ||
| hostname = "viper"; | ||
| userInitialPassword = "test"; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P1: Do not ship this host with a hard-coded known password; it creates a trivially guessable admin login. Prompt for AI agents |
||
| }) | ||
| ( | ||
| { | ||
| lib, | ||
| modulesPath, | ||
| ... | ||
| }: | ||
| { | ||
| imports = [ (modulesPath + "/profiles/qemu-guest.nix") ]; | ||
|
|
||
| boot.loader.grub.enable = true; | ||
| boot.loader.grub.device = "/dev/vda"; | ||
| boot.loader.timeout = 3; | ||
|
|
||
| fileSystems."/" = { | ||
| device = "/dev/disk/by-label/nixos"; | ||
| fsType = "ext4"; | ||
| }; | ||
|
|
||
| environment.systemPackages = with pkgs; [ | ||
| curl | ||
| git | ||
| vim | ||
| ]; | ||
|
|
||
| services.openssh.enable = true; | ||
|
|
||
| virtualisation.vmVariant = { | ||
| virtualisation = { | ||
| graphics = false; | ||
| memorySize = 4096; | ||
| cores = 4; | ||
| }; | ||
| users.users.${username}.initialPassword = lib.mkForce "test"; | ||
| }; | ||
| } | ||
| ) | ||
| ]; | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P2: Restrict the auto-detected fallback to hosts that actually have a NixOS VM output. As written,
HOSTomitted ongalacticaresolves to a missingnixosConfigurations.galacticaattribute and the target fails.Prompt for AI agents