diff --git a/.github/workflows/emulator.yml b/.github/workflows/emulator.yml index 9ecd277..5e312fa 100644 --- a/.github/workflows/emulator.yml +++ b/.github/workflows/emulator.yml @@ -14,14 +14,17 @@ 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 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" @@ -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,20 +138,23 @@ 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') - 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 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; 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"; }; }; 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 ;;