From c2b4f2294c30ea5546c4dcfbd9b18c297258c75b Mon Sep 17 00:00:00 2001
From: Jean-Paul Calderone <exarkun@twistedmatrix.com>
Date: Thu, 1 Dec 2022 15:32:33 -0500
Subject: [PATCH] some additional flailing

---
 Notes.rst  | 24 ++++++++++++++++++++++++
 flake.lock |  8 ++++----
 flake.nix  | 38 +++++++++++++++++++++++++++++++++++---
 3 files changed, 63 insertions(+), 7 deletions(-)

diff --git a/Notes.rst b/Notes.rst
index 71c7451..0a315c2 100644
--- a/Notes.rst
+++ b/Notes.rst
@@ -4,6 +4,30 @@
 
     * Build an app that can read magic-folders and download linked files
 
+      * Build an app that runs a Haskell Tahoe-LAFS implementation on Android
+
+	* Reflex-FRP / Obsidian Systems Obelisk?
+	  https://reflex-frp.org/tutorial
+	  https://github.com/obsidiansystems/obelisk
+
+	  * The Obelisk readme basically works.
+	  * Adding a native extension seems tricky.
+
+	    * Obelisk pins a reflex-platform
+	    * reflex-platform pins a nixpkgs
+	    * reflex-platform various arguments to control nixpkgs
+
+	      * nixpkgsFunc to completely replace the nixpkgs used
+	      * nixpkgsOverlays to contribute overlays to nixpkgs
+	      * config to pass other config to nixpkgs
+
+	    * Obelisk does not accept nixpkgsFunc or nixpkgsOverlays
+
+	      * But it does accept reflex-platform-func
+	      * So override this with a version that passes an overlay to reflex, I guess
+
+
+
       * Build an app that runs the Python Tahoe-LAFS implementation on Android
 
 	* Build Tahoe-LAFS & ZKAPAuthorizer for Android
diff --git a/flake.lock b/flake.lock
index 483e1d4..0b312b6 100644
--- a/flake.lock
+++ b/flake.lock
@@ -60,16 +60,16 @@
     },
     "nixpkgs": {
       "locked": {
-        "lastModified": 1667821506,
-        "narHash": "sha256-u4HKBBfTOPpFsGnM7sjS0+F67Hmf2or3uHKNVxXZtiM=",
+        "lastModified": 1669145459,
+        "narHash": "sha256-NN18jHL7UvYjfCjnwH5eX64D9R+4TNAd+YyPpTfYJAw=",
         "owner": "NixOS",
         "repo": "nixpkgs",
-        "rev": "ebf65554b18ee053311f43e5faa5a3f36626c52e",
+        "rev": "fd83da2b640e05c6dd14fad4b741714b069ae0d7",
         "type": "github"
       },
       "original": {
         "owner": "NixOS",
-        "ref": "nixos-22.05",
+        "ref": "staging",
         "repo": "nixpkgs",
         "type": "github"
       }
diff --git a/flake.nix b/flake.nix
index 073acf9..4c00ea8 100644
--- a/flake.nix
+++ b/flake.nix
@@ -2,7 +2,7 @@
   description = "The PrivateStorage Mobile application";
   inputs = {
     nixpkgs = {
-      url = "github:NixOS/nixpkgs?ref=nixos-22.05";
+      url = "github:NixOS/nixpkgs?ref=staging";
     };
     flake-utils.url = "github:numtide/flake-utils";
     pypi-deps-db = {
@@ -111,7 +111,7 @@
         '';
       };
     in {
-      # packages.host-python = (import nixpkgs { system = "aarch64-linux-android"; }).python3Minimal.override { self = self.packages.host-python; };
+      packages.host-python = pkgs.pkgsCross.aarch64-android.python3Minimal;
 
       packages.apk = pkgs.androidenv.buildApp {
         name = "PrivateStorage Mobile";
@@ -137,6 +137,30 @@
         in
           "${emulator}/bin/run-test-emulator";
       };
+
+      apps.emulate-python = {
+        type = "app";
+        program = let
+          emulator = pkgs.androidenv.emulateApp {
+            name = "PrivateStorage Mobile";
+            inherit platformVersion;
+            abiVersion = "x86_64";
+            systemImageType = "default";
+            app = self.self.packages.${system}.apk;
+            package = "MyApp";
+            activity = "MainActivity";
+          };
+        in
+          "${emulator}/bin/run-test-emulator";
+      };
+
+      devShells.cross = pkgs.mkShell rec {
+        buildInputs =  with pkgs.pkgsCross.aarch64-android; [
+          python3Minimal
+          binutils
+        ];
+      };
+
       devShells.gradle = pkgs.mkShell rec {
         name = "nix-native";
         version = "2022.11.09";
@@ -310,7 +334,11 @@
       # (Q) Does something put the host Python's _sysconfigdata__linux_.py on
       # the build Python's PYTHONPATH?  What?  How?
       #
-      # (Q)
+      # (Q) Who is trying to set _PYTHON_SYSCONFIGDATA_NAME, what are they
+      # trying to set it to, and what purpose are they trying to achieve?
+      #
+      # (Q) Did https://github.com/NixOS/nixpkgs/pull/104201 fix
+      # something relevant to us?
 
       #
       # And now for something completely different.
@@ -321,6 +349,10 @@
       # our nixpkgs-cross-compiled CPython would be a good complement?
       #
 
+      # QEMU can emulate ARM!
+      # https://azeria-labs.com/arm-on-x86-qemu-user/
+      # https://www.bennee.com/~alex/blog/2014/05/09/running-linux-in-qemus-aarch64-system-emulation-mode/
+
 
       # packages.host-python = pkgsCross.aarch64-android.python3Minimal.withPackages (ps: [
       #   # The nixpkgs zfec has some extra dependencies that we might not
-- 
GitLab