Compare commits

..

5 commits

Author SHA1 Message Date
pancho horrillo
7f68d674b3 nix-on-droid: passthrough --override-input arg
Some checks failed
Build bootstrap packages and push to cachix / cachix (push) Has been cancelled
Build and deploy docs / deploy (push) Has been cancelled
Test nix-on-droid in an emulator / prepare-droidctl (push) Has been cancelled
Test nix-on-droid in an emulator / prepare-n-o-d (push) Has been cancelled
Test nix-on-droid in an emulator / prepare-avd (29) (push) Has been cancelled
Run lints / lint (push) Has been cancelled
Test nix-on-droid in an emulator / emulate (29, android_integration) (push) Has been cancelled
Test nix-on-droid in an emulator / emulate (29, bootstrap_channels) (push) Has been cancelled
Test nix-on-droid in an emulator / emulate (29, bootstrap_flakes) (push) Has been cancelled
Test nix-on-droid in an emulator / emulate (29, poke_around) (push) Has been cancelled
Test nix-on-droid in an emulator / emulate (29, test_channels_shell) (push) Has been cancelled
Test nix-on-droid in an emulator / emulate (29, test_channels_uiautomator) (push) Has been cancelled
2025-05-13 19:40:07 +02:00
Hannes
af711651ca Allow unfree packages when building droidctl 2025-05-13 19:39:13 +02:00
Hannes
7c84363a35 Replace magic-nix-cache-action 2025-05-13 19:39:13 +02:00
Zhong Jianxin
a7befd8c98 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]: 3fa87fea66/pkgs/top-level/aliases.nix (L1386)
2025-05-13 19:01:05 +02:00
010aa48cf6 allow both group and username to be changed 2025-05-13 19:00:30 +02:00
4 changed files with 30 additions and 22 deletions

View file

@ -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

View file

@ -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;

View file

@ -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";
};
};

View file

@ -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
;;