nix-community / nix-on-droid

Nix-enabled environment for your Android device. [maintainers=@t184256,@Gerschtli]
https://nix-on-droid.unboiled.info
MIT License
1.16k stars 65 forks source link

error: flake '...' does not provide attribute '...activationPackage' #231

Closed jn-sena closed 1 year ago

jn-sena commented 1 year ago

Hi. Today I've tried making a new build with flakes, and I've come across the following error:

$ nix flake init --template github:t184256/nix-on-droid#minimal
$ nix-on-droid switch --flake .

Building activation package...
error: flake 'path:/data/data/com.termux/nix/files/home/minimal' does not provide attribute 'packages.aarch64-linux.nixOnDroidConfigurations...activationPackage', 'legacyPackages.aarch64-linux.nixOnDroidConfigurations...activationPackage' or 'nixOnDroidConfigurations...activationPackage'

I've tried with all the templates in this repository, and plus my custom configs. None worked.

My current config (without the flakes) is also pretty minimal and contains nothing but vim, git and flakes experimental settings:

{ pkgs, ... }:

{
  environment.packages = with pkgs; [ vim git ];
  nix.extraOptions = ''
    experimental-features = nix-command flakes
  '';
  system.stateVersion = "22.05";
}

A fresh installation of the app didn't change anything as well.

Gerschtli commented 1 year ago

With which bootstrap url did you run the fresh Installation? (The URL that is visible right before the bootstrap process starts.)

The https://nix-on-droid.unboiled.info/bootstrap should point to the latest changes but I am not sure @t184256 updated it after latest PRs.

The problem may be an outdated version of nix-on-droid where the default config name is not yet supported.

Try to update nix-on-droid channel/flake input of the initial configuration, run nix-on-droid switch and try the template again. That should get you up and running.

This flow is not available in a stable release of nix-on-droid yet (will be as soon as 21.11 is out), that's why the new templates require some not released bootstrap zip balls from latest master.

jn-sena commented 1 year ago

Thank you so much for your attention. It indeed works with the latest bootstrap that you've provided. Please forgive my reckless behaviour. I should've checked the older branches' README first. I'm so sorry for stealing your time for non-important stuff.

But the templates still have a tiny little problem that I would like to mention:

The templates on the branch master use the release-22.05 branch as nix-on-droid input, which requires the config argument, but the code in the template uses modules argument instead of config. This causes the following problem.

error: 'nixOnDroidConfiguration' at /nix/store/wn8d0db2zmskrsnvhvzqcik0cn3v9x9h-source/flake.nix:29:9 called without required argument 'config'

    at /nix/store/m9zdv704p6jq1n1bff7qx4n0jk1wq953-source/flake.nix:21:40:

        20|
        21|    nixOnDroidConfigurations.default = nix-on-droid.lib.nixOnDroidConfiguration {
          |                                       ^
        22|      modules = [

This doesn't occur when the input branch is master instead of release-22.05. I guess this isn't that urgent and people can fix it themselves maybe, but I wanted to point it out anyways.

Again, thank you so much for your help. I'm so sorry for bothering you for nothing. My issue has been solved.

Gerschtli commented 1 year ago

No worries :)

Oh that's a good catch. But because the release of 21.11 will happen in a few days, we can probably wait for it and then bump all usages of 22.05 to 22.11 and then it just works.

t184256 commented 1 year ago

My bad. I've updated https://nix-on-droid.unboiled.info/bootstrap/bootstrap-aarch64.zip, which had been previously updated on 2022-10-03.

Gerschtli commented 1 year ago

What do you think about uploading latest zipball as part of the pipeline to reduce manual stuff like this? @t184256

t184256 commented 1 year ago

I'm not comfortable with granting permissions for that to pipelines.

Gerschtli commented 1 year ago

Fixed with #234