Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/42loco42/und

micro nix deployer - soon to be rewritten
https://github.com/42loco42/und

deployment nix nixos

Last synced: 1 day ago
JSON representation

micro nix deployer - soon to be rewritten

Awesome Lists containing this project

README

        

* µnd - micro nix deployer
Inspired by [[https://github.com/numtide/nixos-anywhere][nixos-anywhere]] and [[https://github.com/MatthewCroughan/nixinate][nixinate]], this tool enables you to install and update
a NixOS configuration on any system with SSH and root access and some basic tools.

Rewrite in progress - currently happening in [[https://github.com/42LoCo42/aquaris/blob/main/lib/combined.sh][Aquaris]]!

** Usage
#+begin_src nix
{
inputs = {
# the installation uses disko to prepare the disks
disko.inputs.nixpkgs.follows = "nixpkgs";

und.url = "github:42loco42/und";
};

outputs = { self, nixpkgs, ... }: {
apps = self.inputs.und.und self;
nixosConfigurations = {
test = {
system = "x86_64-linux";
modules = [
./disk.nix # disko config file

self.inputs.disko.nixosModules.disko

{
_module.args.und = {
host = "example.org";
user = "foobar";

# set this option if the user on the old system (which will be overwritten)
# is different from your normal user
# preUser = "barbaz";

# set this option to use a custom kexec tarbarll URL
# otherwise, the default tarball for the config's system
# from https://github.com/nix-community/nixos-images will be used
# kexec = "https://example.org/other-kexec.tar.gz"
};
}
];
};
};
};
}
#+end_src

** Modes of operation
For a configuration named ~test~ (like in the example above),
these are the primary ways to use the script:
#+begin_src shell
nix run .#test -- -i # installs to the target system
nix run .#test # updates the target system

nix run .#test -- -l -i # installs to the local system (e.g. from a NixOS live ISO)
nix run .#test -- -l # updates the local system
#+end_src

** Other options
The following options are also available:
- ~-u, --user~: override the ~user~ option
- ~-h, --host~: override the ~host~ option
- ~-p, --preUser~: override the ~preUser~ option
- ~-k, --kexec~: override the ~kexec~ option
- ~--no-format~: don't format the disks (e.g. to retry a failed installation)
- ~--no-kexec~: don't perform the kexec steps (e.g. when the target is already running a NixOS live environment)
- ~--no-reboot~: don't reboot after the installation has finished (e.g. to configure more stuff)
- ~--save-hwconf ~: generate & save a hardware configuration file to ~~.
The script will then pause to allow further edits and actions (e.g. adding the file to ~git~)

** Notes
- all remote builds happen on the target system to allow installing to different architectures
- all SSH connections have a PTY, so you can enter passwords