commit fd0be0908f84bc546e23c0ff22f8f8d83cc4bbfe
Author: Daniel Barlow <dan@telent.net>
Date: Sat, 13 Jan 2024 13:49:25 +0000
first commit, should have done this a day ago
Diffstat:
5 files changed, 125 insertions(+), 0 deletions(-)
diff --git a/.gitignore b/.gitignore
@@ -0,0 +1 @@
+/local
diff --git a/Makefile b/Makefile
@@ -0,0 +1,17 @@
+DEVICE=root@biscuit.lan
+
+.PHONY: toplevel android-bootimg default update
+
+default:
+ nix-build -A outputs.$@ -o $@
+
+android-bootimg:
+ nix-build -A outputs.android.$@ -o $@
+
+toplevel:
+ nix-build -A outputs.$@ -o $@
+
+update: toplevel android-bootimg
+ nix-copy-closure --to $(DEVICE) -v --include-outputs ./toplevel
+ ssh $(DEVICE) "nix-env --profile /nix/var/nix/profiles/system --set `readlink toplevel` && /nix/var/nix/profiles/system/bin/switch-to-configuration switch"
+ cat android-bootimg | ssh $(DEVICE) "cat >/boot/boot.img"
diff --git a/README b/README
@@ -0,0 +1,37 @@
+
+Config for my moto potter to turn it into a bike computer. We will
+need
+
+- working gps
+- bluetooth (ble) stuff
+- wayland "cage" compositor
+- an app
+- rsync service so that trails can be downloaded to a computer
+- ip connectivity with flight mode
+ - give it telent and dandroid as APs
+ - use rfkill aggressively to save battery
+
+
+Absent any reason I should not write the app in fennel I'm going to
+write the app in fennel. I want it to
+
+- display speed/cadence/time of day/power
+- show where I am on a map
+- record trail of where I've been (note: indoor counts too)
+
+we can use l"ove2d instead of dragging in that gtk stuff
+
+ SDL2
+
+ To run an SDL2 application on Wayland, set
+ SDL_VIDEODRIVER=wayland.
+
+can we do bluetooth not through dbus? dbus seems to make it flakey
+
+
+
+cool extras
+===========
+
+adjust screen brightness (go dark when not moving)
+
diff --git a/configuration.nix b/configuration.nix
@@ -0,0 +1,60 @@
+{ lib, config, pkgs, ... }:
+
+let
+ rpmsgexport = pkgs.stdenv.mkDerivation {
+ name = "rpmsgexport";
+ src = pkgs.fetchFromGitHub {
+ repo = "rpmsgexport";
+ owner = "andersson";
+ rev = "324d88d668f36c6a5e6a9c2003a050b8a5a3cd60";
+ hash = "sha256-k38gj+vtEE6/s+vALzW1jiuE3HdQqaGiICdAWndu6aU=";
+ };
+ makeFlags = ["prefix=${placeholder "out"}"];
+ };
+ secrets = import ./local/secrets.nix;
+in {
+ imports = [
+ (import ../mobile-nixos/lib/configuration.nix { device = "motorola-potter"; })
+ ];
+
+ config = {
+ mobile = {
+ adbd.enable = true;
+ };
+ system.stateVersion = "23.11";
+
+ hardware.firmware = [
+ (config.mobile.device.firmware.override {
+ modem = ./modem;
+ })
+ ];
+ networking = {
+ useDHCP = true;
+ hostName = "biscuit";
+ networkmanager = { enable = false; };
+ inherit (secrets) wireless;
+ };
+
+ services.openssh.enable = true;
+
+# environment.systemPackages = [ qrtr tqftpserv ];
+ services.udev.extraRules = ''
+ # copied from https://github.com/andersson/rpmsgexport
+ ACTION=="add", SUBSYSTEM=="rpmsg", KERNEL=="rpmsg_ctrl[0-9]*", ATTRS{rpmsg_name}=="pronto", RUN+="${rpmsgexport}/bin/rpmsgexport /dev/$name APPS_RIVA_CTRL"
+ SUBSYSTEM=="rpmsg", KERNEL=="rpmsg_ctrl[0-9]*", ATTRS{rpmsg_name}=="?*", SYMLINK+="rpmsg/$attr{rpmsg_name}/ctrl"
+ SUBSYSTEM=="rpmsg", KERNEL=="rpmsg[0-9]*", ATTR{name}=="?*", ATTRS{rpmsg_name}=="?*", SYMLINK+="rpmsg/$attr{rpmsg_name}/$attr{name}"
+ '';
+
+ users.users.dan = {
+ isNormalUser = true;
+ uid = 1000;
+ extraGroups = [ "wheel" "libvirtd" "docker" "dialout" ];
+ openssh.authorizedKeys.keys = import ../telent-nixos-config/users/dan/authorized-keys.nix;
+ };
+
+ fileSystems."/boot" = {
+ device = "/dev/disk/by-partlabel/system";
+ fsType = "ext4";
+ };
+ };
+}
diff --git a/default.nix b/default.nix
@@ -0,0 +1,10 @@
+let
+ pkgs = (import <nixpkgs>) {
+ crossSystem = "aarch64-linux";
+ };
+ nixos =
+ (pkgs.nixos ./configuration.nix);
+in {
+ inherit (nixos.config.system) toplevel;
+ inherit (nixos.config.mobile) outputs;
+}