I'd like to get parts of my CCE running on t184256/nix-on-droid so that I can have my Emacs Tools like SRS and org-roam running on it.
nix-on-droid.nix
This uses Arroyo Home Manager to generate a list of Arroyo modules to include in to the Nix On Droid home-manager environment and then does some basic housekeeping stuff to expose Arroyo Emacs and rixpkgs to that environment.
{ pkgs, ... }:
{
environment.packages = with pkgs; [ vim openssh ];
system.stateVersion = "22.11";
nix.nixPath = [
"nixpkgs=/data/data/com.termux.nix/files/home/.nix-defexpr/channels/nixpkgs/"
"arroyo=/storage/emulated/0/arroyo-nix"
"/data/data/com.termux.nix/files/home/.nix-defexpr/channels"
];
nix.substituters = [
"https://cache.nixos.org/"
"https://nix-community.cachix.org"
];
nix.trustedPublicKeys = [
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
];
nixpkgs.overlays = [
(let emacsOverlay = (import ./versions.nix {}).emacsOverlay null;
in import emacsOverlay)
(import <arroyo/overlay.nix>)
];
home-manager.useGlobalPkgs = true;
time.timeZone = "America/Los_Angeles";
home-manager.config =
{ pkgs, ... }:
{
home.stateVersion = "22.05";
imports = [
()>>
<<home_manager_imports];
programs.ssh.matchBlocks = {
virtuous-cassette = {
hostname = "100.96.6.32";
user = "builder";
identitiesOnly = true;
identityFile = "~/.ssh/id_rsa";
};
window-smoke = {
hostname = "100.79.48.59";
user = "builder";
identitiesOnly = true;
identityFile = "~/.ssh/id_rsa";
};
};
};
}
"droid")
(->> (arroyo-home-manager-imports "\n")) (s-join
hm/contacts.nix
hm/deadgrep.nix
hm/direnv.nix
hm/emacs-helpers.nix
hm/emacs-pager.nix
hm/emacs.nix
hm/git.nix
hm/gnupg.nix
hm/morph.nix
hm/nix-update.nix
hm/org-fc.nix
hm/org-roam.nix
hm/profile.nix
hm/prompt.nix
hm/python.nix
hm/shell-helpers.nix
hm/spell-check.nix
hm/ssh_client.nix
Using machines running My NixOS configuration to as builders for nix-on-droid
Based on the Nix On Droid wiki examples:
Virtuous Cassette is set up
with a builder
user and aarch64
binfmt
emulation:
{ ... }:
{
boot.binfmt.emulatedSystems = [ "aarch64-linux" ];
users.users.builder = {
createHome = true;
isNormalUser = true;
initialPassword = "changeme!";
};
nix.settings.trusted-users = [ "builder" ];
}
Bootstrapping the build setup
On the droid side, it's configured to use this as the builder and SSH to the host over Tailscale:
nix.conf
:
builders-use-substitutes = true
builders = ssh://virtuous-cassette;ssh://window-smoke
.ssh/config
Host virtuous-cassette
HostName 100.96.6.32
User builder
IdentitiesOnly yes
IdentityFile ~/.ssh/id_rsa
Host window-smoke
HostName 100.79.48.59
User builder
IdentitiesOnly yes
IdentityFile ~/.ssh/id_rsa
- set up ssh:
nix-shell -p openssh git
thenssh-keygen
thenssh-copy-id builder
; git is used innix-on-droid build
- set up directories:
ln -s /storage/emulated/0/org ~/org
thenln -s /storage/emulated/0/arroyo-nix ~/arroyo-nix
- install home-manager channel (only used for bootstrap, subsequent builds will use Nix Version Pins)
- then finally
nix-on-droid build -f ~/arroyo-nix/nix-on-droid.nix -I arroyo=$HOME/arroyo-nix
Termux app properties should be set on the Cosmo and other devices with a hardware keyboard:
# extra-keys-style = none doesn't work...
extra-keys = []
back-key = escape
ctrl-space-workaround = true