nix-community / nix-on-droid

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

Flake activation is path-sensitive #127

Closed NobbZ closed 2 years ago

NobbZ commented 3 years ago

I built my simple config using flakes, though when o run the activation script it errors:

[nix-shell:~/nixos-config]$ ./result/activate
Activating linkBinSh
Activating linkUsrBinEnv
Activating installLogin
Activating installLoginInner
Activating installPackages
warning: unknown setting 'experimental-features'
replacing old 'nix-on-droid-path'
installing 'nix-on-droid-path'
building '/nix/store/bqk9kx76aswihwzq5rcy2jhn6m0q60zj-user-environment.drv'...
created 6 symlinks in user environment
Activating installProotStatic
Activating setUpEtc
Activating linkProfile
warning: unknown setting 'experimental-features'
error: getting status of '/data/data/com.termux.nix/files/home/result': No such file or directory
t184256 commented 3 years ago

Does it activate if you add nixFlakes to the list of packages inside the config?

NobbZ commented 3 years ago

Same error:

[nix-shell:~/nixos-config]$ ./result/activate           Activating linkBinSh
Activating linkUsrBinEnv
Activating installLogin
Activating installLoginInner
Activating installPackages
warning: unknown setting 'experimental-features'
replacing old 'nix-on-droid-path'
installing 'nix-on-droid-path'
building '/nix/store/xwc5mq5r28yd20d4s0isy4wsggnkaq3p-user-environment.drv'...
created 6 symlinks in user environment
Activating installProotStatic
Activating setUpEtc
Activating linkProfile
warning: unknown setting 'experimental-features'
error: getting status of '/data/data/com.termux.nix/files/home/result': No such file or directory

The relevant part seems to be the final line where it searches for a ~/result, while I run ~/nixos-config/result/activate with ~/nixos-config as PWD.

Probably some pathes hardcoded that shouldn't be?

NobbZ commented 3 years ago

Activation succeeded after I created a symlink ~/result to ~/nixos-config/result

Gerschtli commented 3 years ago

I am not sure why this should not work but the problematic lines are https://github.com/t184256/nix-on-droid/blob/master/modules/build/activation.nix#L131-L137.

Could you add something like the following and post the results?

{
  build.activationBefore.printDebug = ''
    echo "0: $0"
  '';
}
Gerschtli commented 2 years ago

Is resolved by https://github.com/t184256/nix-on-droid/pull/136