From 2f618bd349e73ce39d924fedc70998080b642158 Mon Sep 17 00:00:00 2001 From: Sebastian Wendel Date: Tue, 30 Jul 2024 12:01:25 +0200 Subject: [PATCH] initial commit --- .envrc | 7 ++ .gitignore | 53 ++++++++++++++ README.md | 61 ++++++++++++++++ flake.lock | 205 +++++++++++++++++++++++++++++++++++++++++++++++++++++ flake.nix | 39 ++++++++++ 5 files changed, 365 insertions(+) create mode 100644 .envrc create mode 100644 .gitignore create mode 100644 README.md create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..c0208ac --- /dev/null +++ b/.envrc @@ -0,0 +1,7 @@ +# use flake +use flake . --impure + +eval "$shellHook" + +export NIXPKGS_ALLOW_INSECURE=1 + diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..447d929 --- /dev/null +++ b/.gitignore @@ -0,0 +1,53 @@ +.envrc.local +.*.swo +.*.swp +.direnv +.DS_Store +.pre-commit-config.yaml +result* +*.qcow2 +*.log +temp +*.pyc +TODOS.md +.devenv + +# terraform +.terraform +*.tf.json +*.tfstate + +# Local .terraform directories +**/.terraform/* + +# .tfstate files +*.tfstate +*.tfstate.* + +# Crash log files +crash.log +crash.*.log + +# Exclude all .tfvars files, which are likely to contain sensitive data, such as +# password, private keys, and other secrets. These should not be part of version +# control as they are data points which are potentially sensitive and subject +# to change depending on the environment. +*.tfvars +*.tfvars.json + +# Ignore override files as they are usually used to override resources locally and so +# are not checked in +override.tf +override.tf.json +*_override.tf +*_override.tf.json + +# Include override files you do wish to add to version control using negated pattern +# !example_override.tf + +# Include tfplan files to ignore the plan output of command: terraform plan -out=tfplan +# example: *tfplan* + +# Ignore CLI configuration files +.terraformrc +terraform.rc diff --git a/README.md b/README.md new file mode 100644 index 0000000..1b5748d --- /dev/null +++ b/README.md @@ -0,0 +1,61 @@ +# SRX Robotnix Android + +## Commands + +### Build + +#### Image + +```sh +NIXPKGS_ALLOW_INSECURE=1 nix build .\# --impure +``` + +#### Emulator + +```sh +nix-build --arg configuration { device="x86_64"; flavor="vanilla"; } -A build.emulator +``` + +### Flash + +```sh +fastboot update -w ./result +``` + +## Issues + +### auto-patchelf 1 dependencies could not be satisfied + +```txt +patching script interpreter paths in /nix/store/jfgs4v5jiqqp33msl90jmlqb91arhvff-aapt2 +stripping (with command strip and flags -S -p) in /nix/store/jfgs4v5jiqqp33msl90jmlqb91arhvff-aapt2/bin +automatically fixing dependencies for ELF files +{'append_rpaths': [], + 'extra_args': [], + 'ignore_missing': [], + 'libs': [PosixPath('/nix/store/j6zw04xlczkkrwmjrya1h8ycciasqckk-auto-patchelf-hook/lib'), + PosixPath('/nix/store/h7ywv0949dwkp6kdvqbvi9y1yicl0ipp-binutils-wrapper-2.40/lib'), + PosixPath('/nix/store/yf4fcxik258lrm0r4vxjv05wy1svd6i2-patchelf-0.15.0/lib'), + PosixPath('/nix/store/cdlnsi5c5siqzich9yblqcwcslfv1wa9-binutils-wrapper-2.40/lib')], + 'paths': [PosixPath('/nix/store/jfgs4v5jiqqp33msl90jmlqb91arhvff-aapt2')], + 'recursive': True, + 'runtime_dependencies': []} +setting interpreter of /nix/store/jfgs4v5jiqqp33msl90jmlqb91arhvff-aapt2/bin/aapt2 +searching for dependencies of /nix/store/jfgs4v5jiqqp33msl90jmlqb91arhvff-aapt2/bin/aapt2 + libgcc_s.so.1 -> not found! +auto-patchelf: 1 dependencies could not be satisfied +error: auto-patchelf could not satisfy dependency libgcc_s.so.1 wanted by /nix/store/jfgs4v5jiqqp33msl90jmlqb91arhvff-aapt2/bin/aapt2 +auto-patchelf failed to find all the required dependencies. +Add the missing dependencies to --libs or use `--ignore-missing="foo.so.1 bar.so etc.so"`. +/nix/store/y6x85gyyndgbvzvdlz1y69gs1zxsa29f-stdenv-linux/setup: line 74: pop_var_context: head of shell_variables not a function context +/nix/store/y6x85gyyndgbvzvdlz1y69gs1zxsa29f-stdenv-linux/setup: line 1458: pop_var_context: head of shell_variables not a function context +/nix/store/y6x85gyyndgbvzvdlz1y69gs1zxsa29f-stdenv-linux/setup: line 1561: pop_var_context: head of shell_variables not a function context +``` + +## Links + +- https://www.youtube.com/watch?v=tj8t0aRaUro +- https://talks.nixcon.org/nixcon2020/talk/AK98WZ/ +- https://nixos.wiki/wiki/Android +- https://github.com/Kranzes/robotnix-personal/ +- https://github.com/ajs124/robotnix-hydra/ \ No newline at end of file diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..9c24346 --- /dev/null +++ b/flake.lock @@ -0,0 +1,205 @@ +{ + "nodes": { + "androidPkgs": { + "inputs": { + "devshell": "devshell", + "flake-utils": "flake-utils_2", + "nixpkgs": "nixpkgs" + }, + "locked": { + "lastModified": 1711829704, + "narHash": "sha256-y1ii2SZKesn4wwqn/7g9SN1oBk0t7piQhGmijVBGXfI=", + "owner": "tadfisher", + "repo": "android-nixpkgs", + "rev": "b8cae01d03eb9ded03c00fa1eeef7d448a46d77f", + "type": "github" + }, + "original": { + "owner": "tadfisher", + "ref": "stable", + "repo": "android-nixpkgs", + "type": "github" + } + }, + "devshell": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": [ + "robotnix", + "androidPkgs", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1711099426, + "narHash": "sha256-HzpgM/wc3aqpnHJJ2oDqPBkNsqWbW0WfWUO8lKu8nGk=", + "owner": "numtide", + "repo": "devshell", + "rev": "2d45b54ca4a183f2fdcf4b19c895b64fbf620ee8", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "devshell", + "type": "github" + } + }, + "flake-compat": { + "locked": { + "lastModified": 1688025799, + "narHash": "sha256-ktpB4dRtnksm9F5WawoIkEneh1nrEvuxb5lJFt1iOyw=", + "owner": "nix-community", + "repo": "flake-compat", + "rev": "8bf105319d44f6b9f0d764efa4fdef9f1cc9ba1c", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1701680307, + "narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "4022d587cbbfd70fe950c1e2083a02621806a725", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_2": { + "inputs": { + "systems": "systems_2" + }, + "locked": { + "lastModified": 1710146030, + "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1711703276, + "narHash": "sha256-iMUFArF0WCatKK6RzfUJknjem0H9m4KgorO/p3Dopkk=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "d8fe5e6c92d0d190646fb9f1056741a229980089", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-unstable": { + "locked": { + "lastModified": 1716330097, + "narHash": "sha256-8BO3B7e3BiyIDsaKA0tY8O88rClYRTjvAp66y+VBUeU=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "5710852ba686cc1fd0d3b8e22b3117d43ba374c2", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1720535198, + "narHash": "sha256-zwVvxrdIzralnSbcpghA92tWu2DV2lwv89xZc8MTrbg=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "205fd4226592cc83fd4c0885a3e4c9c400efabb5", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-23.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "robotnix": { + "inputs": { + "androidPkgs": "androidPkgs", + "flake-compat": "flake-compat", + "nixpkgs": "nixpkgs_2", + "nixpkgs-unstable": "nixpkgs-unstable" + }, + "locked": { + "lastModified": 1718643073, + "narHash": "sha256-VPckIVFRgt+pH8ruQqdGaUpqvjMV8INVeeJdhQZ3oe4=", + "owner": "nix-community", + "repo": "robotnix", + "rev": "f079afb0a6f6939e49813be34db9aa7db743d439", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "robotnix", + "type": "github" + } + }, + "root": { + "inputs": { + "robotnix": "robotnix" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_2": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..fdb55f6 --- /dev/null +++ b/flake.nix @@ -0,0 +1,39 @@ +{ + description = "srx personal robotnix configuration"; + + nixConfig = { + extra-substituters = [ "https://robotnix.cachix.org" ]; + extra-trusted-public-keys = [ "robotnix.cachix.org-1:+y88eX6KTvkJyernp1knbpttlaLTboVp4vq/b24BIv0=" ]; + }; + + inputs.robotnix.url = "github:nix-community/robotnix"; + + outputs = { self, robotnix, ... }: + let + ccache.enable = true; + microg.enable = true; + in + { + robotnixConfigurations = { + localTesting = robotnix.lib.robotnixSystem ({ config, pkgs, ... }: { + device = "x86_64"; + flavor = "vanilla"; + inherit ccache microg; + }); + + pixel7a = robotnix.lib.robotnixSystem ({ config, pkgs, ... }: { + device = "lynx"; + flavor = "grapheneos"; + inherit ccache microg; + }); + + pixel4a = robotnix.lib.robotnixSystem ({ config, pkgs, ... }: { + device = "sunfish"; + flavor = "vanilla"; + inherit ccache microg; + }); + }; + + defaultPackage.x86_64-linux = self.robotnixConfigurations.localTesting.img; + }; +}