This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
manuals:vps:userdata [2025/03/14 20:31] – created aither | manuals:vps:userdata [2025/03/16 14:08] (current) – [NixOS Flake URI] fix nixos-rebuild aither | ||
---|---|---|---|
Line 5: | Line 5: | ||
* [[# | * [[# | ||
* [[# | * [[# | ||
+ | * [[# | ||
+ | * [[# | ||
+ | * [[# | ||
Scripts and configurations can be stored in vpsAdmin, and you can select the configuration method when creating/ | Scripts and configurations can be stored in vpsAdmin, and you can select the configuration method when creating/ | ||
Line 67: | Line 70: | ||
The cloud-init output can be seen in the kernel log and is stored in ''/ | The cloud-init output can be seen in the kernel log and is stored in ''/ | ||
+ | |||
+ | ==== NixOS Configuration ==== | ||
+ | The provided configuration is saved to ''/ | ||
+ | |||
+ | Example configuration: | ||
+ | |||
+ | <code nix> | ||
+ | { config, pkgs, lib, ... }: | ||
+ | { | ||
+ | imports = [ | ||
+ | / | ||
+ | ]; | ||
+ | |||
+ | environment.systemPackages = with pkgs; [ | ||
+ | vim | ||
+ | ]; | ||
+ | |||
+ | services.openssh.enable = true; | ||
+ | services.openssh.settings.PermitRootLogin = " | ||
+ | # | ||
+ | # [ " | ||
+ | |||
+ | systemd.extraConfig = '' | ||
+ | DefaultTimeoutStartSec=900s | ||
+ | ''; | ||
+ | |||
+ | time.timeZone = " | ||
+ | |||
+ | system.stateVersion = " | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | The output of the '' | ||
+ | |||
+ | ==== NixOS Flake Configuration ==== | ||
+ | The configuration is saved to the file ''/ | ||
+ | |||
+ | Example configuration: | ||
+ | |||
+ | <code nix> | ||
+ | { | ||
+ | inputs = { | ||
+ | nixpkgs.url = github: | ||
+ | vpsadminos.url = github: | ||
+ | }; | ||
+ | | ||
+ | outputs = { self, nixpkgs, vpsadminos }: { | ||
+ | # The configuration must include a system named " | ||
+ | nixosConfigurations.vps = nixpkgs.lib.nixosSystem { | ||
+ | modules = [ | ||
+ | ({ config, pkgs, lib, ... }: | ||
+ | { | ||
+ | imports = [ | ||
+ | vpsadminos.nixosConfigurations.container | ||
+ | ]; | ||
+ | |||
+ | environment.systemPackages = with pkgs; [ | ||
+ | vim | ||
+ | ]; | ||
+ | |||
+ | services.openssh.enable = true; | ||
+ | services.openssh.settings.PermitRootLogin = " | ||
+ | # | ||
+ | # [ " | ||
+ | |||
+ | systemd.extraConfig = '' | ||
+ | DefaultTimeoutStartSec=900s | ||
+ | ''; | ||
+ | |||
+ | time.timeZone = " | ||
+ | |||
+ | nixpkgs.hostPlatform = lib.mkDefault " | ||
+ | |||
+ | system.stateVersion = " | ||
+ | }) | ||
+ | ]; | ||
+ | }; | ||
+ | }; | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | The output of the '' | ||
+ | |||
+ | ==== NixOS Flake URI ==== | ||
+ | Upon VPS startup, the command '' | ||
+ | |||
+ | Example configuration: | ||
+ | |||
+ | <code nix> | ||
+ | github: | ||
+ | </ | ||
+ | |||
+ | You can find this configuration at https:// | ||
+ | |||
+ | The output of the '' | ||
===== Usage with vpsfreectl ===== | ===== Usage with vpsfreectl ===== | ||
Line 97: | Line 195: | ||
vpsfreectl vps reinstall 123 -- --user-data-format script --user-data-content @my-script.sh | vpsfreectl vps reinstall 123 -- --user-data-format script --user-data-content @my-script.sh | ||
</ | </ | ||
+ | |||
+ | ===== Supported distributions ===== | ||
+ | |||
+ | All distributions are supported with the following exceptions: | ||
+ | |||
+ | * script is not supported on Guix, NixOS and Slackware | ||
+ | * cloud-init is not supported on Guix, NixOS, Slackware and Void Linux | ||