Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/42loco42/und
- Owner: 42LoCo42
- Created: 2023-10-25T08:32:45.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-01-29T09:18:17.000Z (10 months ago)
- Last Synced: 2024-01-29T11:09:55.280Z (10 months ago)
- Topics: deployment, nix, nixos
- Language: Shell
- Homepage:
- Size: 33.2 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.org
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 fileself.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 systemnix 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