diff --git a/clients/quadphone/nixphone.nix b/clients/quadphone/nixphone.nix new file mode 100644 index 0000000..b3ceb03 --- /dev/null +++ b/clients/quadphone/nixphone.nix @@ -0,0 +1,19 @@ +{ + inputs, + lib, + config, + crossPkgs, + ... +}: +{ + imports = [ + ( + _: + import inputs.nixphone.nixosModules.sdm845-oneplus-fajita { + inherit lib config; + pkgs = crossPkgs; + inputs = inputs.sdm845.inputs; + } + ) + ]; +} diff --git a/flake.lock b/flake.lock index 0cc79fd..939cc9d 100644 --- a/flake.lock +++ b/flake.lock @@ -891,6 +891,26 @@ "type": "github" } }, + "nixphone": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1792196447, + "narHash": "sha256-cDxL/uTDeD2xD7AGP6s/YdsGSlWOK9okdAptxjWcFgk=", + "ref": "refs/heads/master", + "rev": "5bc9b52b9486bcfc4f709d0582dfa7345ef9c1b4", + "revCount": 28, + "type": "git", + "url": "https://codeberg.org/nixphone/nixphone" + }, + "original": { + "type": "git", + "url": "https://codeberg.org/nixphone/nixphone" + } + }, "nixpkgs": { "locked": { "lastModified": 1773389992, @@ -1118,6 +1138,7 @@ "nexus": "nexus", "nexusbot": "nexusbot", "nix-maid": "nix-maid", + "nixphone": "nixphone", "nixpkgs": "nixpkgs_2", "redlib": "redlib", "run0-sudo-shim": "run0-sudo-shim", diff --git a/flake.nix b/flake.nix index 531df13..34937bc 100755 --- a/flake.nix +++ b/flake.nix @@ -4,6 +4,10 @@ wrapper-manager.url = "git+https://codeberg.org/viperML/wrapper-manager"; flake-parts.url = "github:hercules-ci/flake-parts"; nix-maid.url = "git+https://codeberg.org/viperML/nix-maid"; + nixphone = { + url = "git+https://codeberg.org/nixphone/nixphone"; + inputs.nixpkgs.follows = "nixpkgs"; + }; continuwuity = { url = "git+https://forgejo.ellis.link/continuwuation/continuwuity?ref=nex/fix/gapfill-pdu-format"; inputs.nixpkgs.follows = "nixpkgs"; @@ -105,6 +109,20 @@ specialArgs = { inherit inputs dirUtils; inherit (info) type; + + crossPkgs = import inputs.nixpkgs { + hostPlatform = info.system; + localSystem = info.system; + buildPlatform = "x86_64-linux"; + + overlays = + let + path = ./cross-overlays/${info.hostname}; + in + dirUtils.opt (builtins.pathExists path) ( + map (file: import file inputs) (lib.filesystem.listFilesRecursive path) + ); + }; }; modules = @@ -155,9 +173,14 @@ ) ) { - "quadraticpc".type = "desktop"; - "quadtop".type = "desktop"; - "quadraticserver" = { + + quadraticpc.type = "desktop"; + quadtop.type = "desktop"; + quadphone = { + type = "mobile"; + system = "aarch64-linux"; + }; + quadraticserver = { type = "server"; graphical = false; }; diff --git a/modules/desktop/binfmt/default.nix b/modules/desktop/binfmt/default.nix new file mode 100644 index 0000000..5b180c0 --- /dev/null +++ b/modules/desktop/binfmt/default.nix @@ -0,0 +1,11 @@ +{ + boot.binfmt.emulatedSystems = [ "aarch64-linux" ]; + nixpkgs.overlays = [ + (_: super: { + # Because of https://github.com/NixOS/nixpkgs/pull/378579 + qemu = super.qemu.overrideAttrs (old: { + patches = (old.patches or [ ]) ++ [ ./qemu.patch ]; + }); + }) + ]; +} diff --git a/modules/desktop/binfmt/qemu.patch b/modules/desktop/binfmt/qemu.patch new file mode 100644 index 0000000..4817501 --- /dev/null +++ b/modules/desktop/binfmt/qemu.patch @@ -0,0 +1,16 @@ +diff --git a/util/rcu.c b/util/rcu.c +index fa32c942e4..8ae899f74e 100644 +--- a/util/rcu.c ++++ b/util/rcu.c +@@ -409,12 +409,6 @@ static void rcu_init_complete(void) + + qemu_event_init(&rcu_call_ready_event, false); + +- /* The caller is assumed to have BQL, so the call_rcu thread +- * must have been quiescent even after forking, just recreate it. +- */ +- qemu_thread_create(&thread, "call_rcu", call_rcu_thread, +- NULL, QEMU_THREAD_DETACHED); +- + rcu_register_thread(); + } diff --git a/modules/mobile/allow-broken.nix b/modules/mobile/allow-broken.nix new file mode 100644 index 0000000..0745649 --- /dev/null +++ b/modules/mobile/allow-broken.nix @@ -0,0 +1 @@ +{ nixpkgs.config.allowBroken = true; } diff --git a/modules/mobile/disable-man.nix b/modules/mobile/disable-man.nix new file mode 100644 index 0000000..0db3e6b --- /dev/null +++ b/modules/mobile/disable-man.nix @@ -0,0 +1 @@ +{ documentation.man.generateCaches = false; } diff --git a/modules/mobile/phosh.nix b/modules/mobile/phosh.nix new file mode 100644 index 0000000..71305f6 --- /dev/null +++ b/modules/mobile/phosh.nix @@ -0,0 +1,38 @@ +{ pkgs, ... }: +{ + programs = { + feedbackd.enable = true; + calls.enable = true; + firefox.package = pkgs.firefox-mobile; + }; + + environment.systemPackages = with pkgs; [ + chatty + ]; + + nixpkgs.config.permittedInsecurePackages = [ + "olm-3.2.16" + ]; + + networking.modemmanager.enable = true; + + services = { + geoclue2 = { + enable = true; + whitelistedAgents = [ "sm.puri.Phosh" ]; + appConfig."sm.puri.Phosh" = { + isAllowed = true; + isSystem = true; + }; + }; + + xserver.desktopManager.phosh = { + enable = true; + group = "users"; + user = "quadradical"; + }; + }; + + users.users.geoclue.extraGroups = [ "networkmanager" ]; + location.provider = "geoclue2"; +}