# NixOS This page builds a NixOS rootfs for Droidspaces with Nix, and sets up your own NixOS configuration to run in a container. Droidspaces itself must already be installed: see [Android installation](Installation-Android.md) or [Linux installation](Installation-Linux.md). ## Build a tarball The repository's flake builds a minimal NixOS rootfs for Droidspaces: ```sh nix build github:ravindu644/Droidspaces-OSS#nixosDroidspacesTarballs.aarch64-linux.minimal ``` systemd 260 needs kernel 5.10 or newer. On a 5.4 to 5.9 kernel, build the variant with systemd 259 instead: ```sh nix build github:ravindu644/Droidspaces-OSS#nixosDroidspacesTarballs.aarch64-linux.minimal-with-systemd-v259 ``` On an older kernel, systemd 258 and newer need the [kernel backports](Kernel-Configuration.md#modern-systemd-on-4x-and-54-kernels), so build a variant with systemd 257: `minimal-with-systemd-v257` from an older nixpkgs, or `minimal-with-pinned-systemd-v257` from the current one with systemd held at 257. Install the result with **Install from file** in the app, or point `--rootfs` at the extracted directory on Linux. Once it boots, configure it. ## Configure NixOS for Droidspaces Import the `working-droidspaces-rootfs-minimal` module into your system: ```nix # flake.nix droidspaces.url = "github:ravindu644/Droidspaces-OSS"; # configuration {inputs, ...}: { imports = [inputs.droidspaces.nixosModules.working-droidspaces-rootfs-minimal]; } ``` On a 5.4 to 5.9 kernel, pin nixpkgs to the release with systemd 259: ```nix nixpkgs-with-systemd-v259.url = "github:NixOS/nixpkgs/b86751bc4085f48661017fa226dee99fab6c651b"; ``` The module can also build your own configuration as a Droidspaces tarball: ```sh nix build .#nixosConfigurations..config.system.build.tarball ``` ## Without systemd Set the container's custom init to `/bin/sh`. You can enter the container and use it as a shell environment, and no services run. ## Finix (experimental) Finix is an experimental NixOS-like system that uses finit as its init instead of systemd: ```sh nix build github:ravindu644/Droidspaces-OSS#finixDroidspacesTarballs.aarch64-linux.experimental ``` --- Previous: [Troubleshooting](Troubleshooting.md) | Next: [Networking from zero](Networking-From-Zero.md)