From 010aa48cf613ce3b4a0ed57457920f66ff3239f8 Mon Sep 17 00:00:00 2001 From: osbm Date: Thu, 27 Feb 2025 21:23:39 +0300 Subject: [PATCH 1/5] allow both group and username to be changed --- modules/user.nix | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/modules/user.nix b/modules/user.nix index 6ed9f91..6769e3d 100644 --- a/modules/user.nix +++ b/modules/user.nix @@ -28,7 +28,7 @@ in user = { group = mkOption { type = types.str; - readOnly = true; + default = "nix-on-droid"; description = "Group name."; }; @@ -56,7 +56,7 @@ in userName = mkOption { type = types.str; - readOnly = true; + default = "nix-on-droid"; description = "User name."; }; @@ -90,9 +90,7 @@ in }; user = { - group = "nix-on-droid"; home = "/data/data/com.termux.nix/files/home"; - userName = "nix-on-droid"; }; }; From a7befd8c98f02bbaf48fb229cb20b9a450d9ffad Mon Sep 17 00:00:00 2001 From: Zhong Jianxin Date: Sat, 23 Nov 2024 15:29:09 +0800 Subject: [PATCH 2/5] flake.nix: pkgs.system -> pkgs.stdenv.hostPlatform.system `pkgs.system` is now an [alias][1] to `pkgs.stdenv.hostPlatform.system`. After this it's possible to set `config.allowAliases = false` for nixpkgs: ``` nixOnDroidConfigurations.default = nix-on-droid.lib.nixOnDroidConfiguration { pkgs = import nixpkgs { config.allowAliases = false; system = "aarch64-linux"; }; modules = [ ./nix-on-droid.nix ]; }; ``` [1]: https://github.com/NixOS/nixpkgs/blob/3fa87fea664455138adbb1b5561949d5efb74438/pkgs/top-level/aliases.nix#L1386 --- flake.nix | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/flake.nix b/flake.nix index ad92e98..cd09399 100644 --- a/flake.nix +++ b/flake.nix @@ -77,11 +77,11 @@ # deprecated: , config ? null , extraModules ? null - , system ? null # pkgs.system is used to detect user's arch + , system ? null # pkgs.stdenv.hostPlatform.system is used to detect user's arch }: - if ! (builtins.elem pkgs.system [ "aarch64-linux" "x86_64-linux" ]) then + if ! (builtins.elem pkgs.stdenv.hostPlatform.system [ "aarch64-linux" "x86_64-linux" ]) then throw - ("${pkgs.system} is not supported; aarch64-linux / x86_64-linux " + + ("${pkgs.stdenv.hostPlatform.system} is not supported; aarch64-linux / x86_64-linux " + "are the only currently supported system types") else pkgs.lib.throwIf @@ -95,12 +95,12 @@ have been removed. Instead of 'extraModules' use the argument 'modules'. - The 'system' will be inferred by 'pkgs.system', + The 'system' will be inferred by 'pkgs.stdenv.hostPlatform.system', so pass a 'pkgs = import nixpkgs { system = "aarch64-linux"; };' See the 22.11 release notes for more. '' (import ./modules { - targetSystem = pkgs.system; # system to cross-compile to + targetSystem = pkgs.stdenv.hostPlatform.system; # system to cross-compile to inherit extraSpecialArgs home-manager-path pkgs; config.imports = modules; isFlake = true; From 7c84363a358aee4444d5fde2dfe8b941eb6af33f Mon Sep 17 00:00:00 2001 From: Hannes Date: Fri, 9 May 2025 09:28:25 +0800 Subject: [PATCH 3/5] Replace magic-nix-cache-action --- .github/workflows/emulator.yml | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/.github/workflows/emulator.yml b/.github/workflows/emulator.yml index 9ecd277..e434762 100644 --- a/.github/workflows/emulator.yml +++ b/.github/workflows/emulator.yml @@ -14,9 +14,12 @@ jobs: path: ${{ steps.droidctl-build.outputs.path }} steps: - name: Install Nix - uses: DeterminateSystems/nix-installer-action@main - - name: Configure Nix magic cache - uses: DeterminateSystems/magic-nix-cache-action@main + uses: nixbuild/nix-quick-install-action@master + - name: Configure Nix cache + uses: nix-community/cache-nix-action@main + with: + primary-key: nix-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('**/*.nix', '**/flake.lock') }} + restore-prefixes-first-match: nix-${{ runner.os }}-${{ runner.arch }} - name: Build droidctl id: droidctl-build @@ -30,13 +33,16 @@ jobs: timeout-minutes: 10 steps: - name: Install Nix - uses: DeterminateSystems/nix-installer-action@main + uses: nixbuild/nix-quick-install-action@master - name: Setup cachix uses: cachix/cachix-action@v14 with: name: nix-on-droid - - name: Configure Nix magic cache - uses: DeterminateSystems/magic-nix-cache-action@main + - name: Configure Nix cache + uses: nix-community/cache-nix-action@main + with: + primary-key: nix-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('**/*.nix', '**/flake.lock') }} + restore-prefixes-first-match: nix-${{ runner.os }}-${{ runner.arch }} - name: Checkout repository uses: actions/checkout@v4 @@ -132,16 +138,19 @@ jobs: run: tar xf n-o-d.tar - name: Install Nix / enable KVM - uses: DeterminateSystems/nix-installer-action@main - - name: Configure Nix magic cache - uses: DeterminateSystems/magic-nix-cache-action@main + uses: nixbuild/nix-quick-install-action@master + - name: Configure Nix cache + uses: nix-community/cache-nix-action@main + with: + primary-key: nix-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('**/*.nix', '**/flake.lock') }} + restore-prefixes-first-match: nix-${{ runner.os }}-${{ runner.arch }} - name: Fetch droidctl (using previous eval) id: droidctl-fetch env: DROIDCTL: ${{needs.prepare-droidctl.outputs.path}} run: nix build "$DROIDCTL" --out-link /tmp/droidctl - continue-on-error: true # GitHub Actions can throttle magic-nix-cache + continue-on-error: true # GitHub Actions can throttle cache-nix-action - name: Build droidctl (anew, fallback) if: always() && (steps.droidctl-fetch.outcome == 'failure') From af711651ca02d6918a479942be5d87fde2c352ee Mon Sep 17 00:00:00 2001 From: Hannes Date: Fri, 9 May 2025 11:10:17 +0800 Subject: [PATCH 4/5] Allow unfree packages when building droidctl --- .github/workflows/emulator.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/emulator.yml b/.github/workflows/emulator.yml index e434762..5e312fa 100644 --- a/.github/workflows/emulator.yml +++ b/.github/workflows/emulator.yml @@ -24,7 +24,7 @@ jobs: - name: Build droidctl id: droidctl-build run: | - nix build 'github:t184256/droidctl' --out-link /tmp/droidctl + NIXPKGS_ALLOW_UNFREE=1 nix build --impure 'github:t184256/droidctl' --out-link /tmp/droidctl echo "path=$(realpath /tmp/droidctl)" >> "$GITHUB_OUTPUT" @@ -154,7 +154,7 @@ jobs: - name: Build droidctl (anew, fallback) if: always() && (steps.droidctl-fetch.outcome == 'failure') - run: nix build 'github:t184256/droidctl' --out-link /tmp/droidctl + run: NIXPKGS_ALLOW_UNFREE=1 nix build --impure 'github:t184256/droidctl' --out-link /tmp/droidctl - name: Restore AVD cache id: avd-cache From 7f68d674b30997434868c9e93784724fdbf37367 Mon Sep 17 00:00:00 2001 From: pancho horrillo Date: Sat, 10 May 2025 07:29:41 +0200 Subject: [PATCH 5/5] nix-on-droid: passthrough --override-input arg --- nix-on-droid/nix-on-droid.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nix-on-droid/nix-on-droid.sh b/nix-on-droid/nix-on-droid.sh index 6b8bd2c..863d785 100644 --- a/nix-on-droid/nix-on-droid.sh +++ b/nix-on-droid/nix-on-droid.sh @@ -68,6 +68,7 @@ function doHelp() { echo " --keep-going" echo " --max-jobs NUM" echo " --option NAME VALUE" + echo " --override-input INPUT URL" echo " --show-trace" echo echo "Commands" @@ -162,7 +163,7 @@ while [[ $# -gt 0 ]]; do -n|--dry-run) export DRY_RUN=1 ;; - --option) + --option|--override-input) PASSTHROUGH_OPTS+=("$opt" "$1" "$2") shift 2 ;;