Switch from infect via cloud-init to nixos-anywhere.
This commit is contained in:
parent
8086dc6f62
commit
32d9721fd5
4 changed files with 82 additions and 2 deletions
|
|
@ -41,5 +41,14 @@ Error: POST https://api.digitalocean.com/v2/droplets: 422 (request "116c778d-8e7
|
||||||
Oh. [Well that sucks](https://docs.digitalocean.com/products/custom-images/details/limits/). Digital Ocean can't do IPv6 on custom images.
|
Oh. [Well that sucks](https://docs.digitalocean.com/products/custom-images/details/limits/). Digital Ocean can't do IPv6 on custom images.
|
||||||
|
|
||||||
## With cloud-init
|
## With cloud-init
|
||||||
|
|
||||||
|
I tried creating a cloud-init function based on NixOS-infect. You can see the content in `digitalocean/infect-nixos.yaml`. I added it to the startup command via `doctl compute droplet create ... --user-data-file digitalocean/infect-nixos.yaml`. This may have a way of working, but I don't get a log and it doesn't get infected, so something fundamental isn't working. I abandoned it.
|
||||||
|
|
||||||
|
## With nixos-anywhere.
|
||||||
|
|
||||||
|
```
|
||||||
|
$ nix run github:nix-community/nixos-anywhere -- --no-disko-deps --flake ./nixos-anywhere#digitalocean --target-host root@64.23.242.187
|
||||||
|
```
|
||||||
|
|
||||||
Cloud init data:
|
Cloud init data:
|
||||||
curl http://169.254.169.254/metadata/v1.json
|
curl http://169.254.169.254/metadata/v1.json
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,5 @@ doctl compute droplet create \
|
||||||
--size s-1vcpu-1gb \
|
--size s-1vcpu-1gb \
|
||||||
--ssh-keys 48777034,46710608 \
|
--ssh-keys 48777034,46710608 \
|
||||||
--tag-name nixos \
|
--tag-name nixos \
|
||||||
--user-data-file digitalocean/infect-nixos.yaml \
|
|
||||||
--wait
|
--wait
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,11 @@
|
||||||
#cloud-config
|
#cloud-config
|
||||||
|
write_files:
|
||||||
|
- path: /etc/nixos/host.nix
|
||||||
|
permissions: '0644'
|
||||||
|
content: |
|
||||||
|
{pkgs, ...}:
|
||||||
|
{
|
||||||
|
environment.systemPackages = with pkgs; [ neofetch neovim ];
|
||||||
|
}
|
||||||
runcmd:
|
runcmd:
|
||||||
– curl https://raw.githubusercontent.com/sheran/nixos-infect/master/nixos-infect | PROVIDER=digitalocean NIX_CHANNEL=nixos-23.05 bash 2>&1 | tee /tmp/infect.log
|
- curl https://raw.githubusercontent.com/elitak/nixos-infect/master/nixos-infect | NIXOS_IMPORT=./host.nix NIX_CHANNEL=nixos-25.05 bash 2>&1 | tee /var/log/infect.log
|
||||||
|
|
|
||||||
64
nixos-anywhere/flake.lock
generated
Normal file
64
nixos-anywhere/flake.lock
generated
Normal file
|
|
@ -0,0 +1,64 @@
|
||||||
|
{
|
||||||
|
"nodes": {
|
||||||
|
"disko": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1752113600,
|
||||||
|
"narHash": "sha256-7LYDxKxZgBQ8LZUuolAQ8UkIB+jb4A2UmiR+kzY9CLI=",
|
||||||
|
"owner": "nix-community",
|
||||||
|
"repo": "disko",
|
||||||
|
"rev": "79264292b7e3482e5702932949de9cbb69fedf6d",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nix-community",
|
||||||
|
"repo": "disko",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixos-facter-modules": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1750412875,
|
||||||
|
"narHash": "sha256-uP9Xxw5XcFwjX9lNoYRpybOnIIe1BHfZu5vJnnPg3Jc=",
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "nixos-facter-modules",
|
||||||
|
"rev": "14df13c84552a7d1f33c1cd18336128fbc43f920",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "nixos-facter-modules",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1751949589,
|
||||||
|
"narHash": "sha256-mgFxAPLWw0Kq+C8P3dRrZrOYEQXOtKuYVlo9xvPntt8=",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "9b008d60392981ad674e04016d25619281550a9d",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "NixOS",
|
||||||
|
"ref": "nixpkgs-unstable",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
"inputs": {
|
||||||
|
"disko": "disko",
|
||||||
|
"nixos-facter-modules": "nixos-facter-modules",
|
||||||
|
"nixpkgs": "nixpkgs"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": "root",
|
||||||
|
"version": 7
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue