-
Notifications
You must be signed in to change notification settings - Fork 87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Any way to deploy from desktop to phone using deploy-rs or nixus? #94
Comments
That should be possible I think. Have a look at |
You'll need an ssh server on the phone if you're keen on initiating that from a desktop, I guess, otherwise it's just https://github.com/t184256/nix-on-droid/wiki/Remote-building. But once you have it, "build something, nix-copy it to the phone and run an activate command on the phone" should just work, yeah. |
Thanks. I think I'm making some progress. Any way to force right now I'm trying to do this: profiles.system.path = deploy-rs.lib.aarch64-linux.activate.custom
(
(import (nix-on-droid + "/modules") {
pkgs = nixpkgs.legacyPackages."aarch64-linux";
config = nix_on_droid_config;
home-manager-src = home-manager;
}).activationPackage
) "./activate"; I think maybe I have to specify current status:
In result, it seems my activate-rs is aarch64 EDIT: ok |
EDIT: I'm calling Current status:
|
Any ideas why the nix-on-droid user would break? EDIT: oh for some reason the nix-on-droid's uid in /etc/passwd is 1000 when I deploy with deploy-rs and it's 10294 when I use EDIT 2: I was able to work around it by hardcoding the "right uid/gid. You can see my fork for my changes.
|
The reason for the wrong uid and gid is, that these values have to be generated on the destination machine. There is a derivation built in modules/user.nix, which has to be built locally. |
Furthermore I think you need the activate script in a profile directory, because we use nix-env --set to switch between generations. Have a look at /nix/var/nix/profiles tree in our default setup. |
Would that help with the uid thing, or it's related to the other problems I had?
Could it be a good idea to have a way to optionally set those ids using the config file? |
I was refering to the comment you made "Edit: well the "no change" might not be normal. Maybe I ran the wrong one.".
I mean you could make these configurable, but the UX would be strange to first setup nix-on-droid the default way, gathering uid and gid, and then hardcode these values. Maybe I am just overthinking :D Would it be possible to build everything remotely except this derivation? IIRC there aren't big dependants of this derivation, so it should be alright to build the remaining things locally on the destination phone. |
Ok I think this issue is working now. Thanks. I'll take a look again if I see the message again.
I was thinking only people wanting to deploy from a desktop like me would have to handle this.
I have no idea how I could build it on my phone while deploying from my desktop (or from github actions). Do you think it could be done at the activation step (on the phone)? |
The activation step is too late, the uid and gid need to be available to build the nix-on-droid generation. Maybe we could refactor everything, but I don't it will work. Sounds like an exciting idea to deploy nix-on-droid config via github actions. If the uid/gid part is the only thing stopping you, you could add these two values as option if you add a note in their description, when to set these manually and when you should rather leave them emtpy and using the ids.nix derivation. I would be fine with this change. |
And if it works for you, it would be awesome if you could and a wiki page explaining your setup :) |
Yeah. It would work for people having access to an aarch64 build box though (which I don't). I should check if github actions has aarch64 nodes. Right now my nix-config builds multiple machines (desktop and laptop) with github actions and pushes it to cachix. Then on my computer I deploy it. It just takes the time required to download and deploy.
Thanks I'll take a look.
Will do! 😄 |
Unfortunately github actions are not available for aarch64-linux AFAIK.. |
I'm using something like the following to build and deploy nix-on-droid with deploy-rs, but I just realized that I'm not using the nix-on-droid overlays. Any ideas how to set the overlays? let
pixel2 = (inputs.nix-on-droid.lib.aarch64-linux.nix-on-droid { config = ../hosts/pixel2; }).activationPackage;
in
{
{
deploy = {
autoRollback = true;
magicRollback = true;
user = "root";
nodes = [
{
pixel2 = {
hostname = "pixel2";
# to prevent using sudo
sshUser = "nix-on-droid";
user = "nix-on-droid";
profiles.nix-on-droid.path = deploy-rs.lib.aarch64-linux.activate.custom
pixel2
(pixel2 + "/activate");
};
};
];
};
} https://github.com/bbigras/nix-config/blob/7d7eb023bee13c9bfcd7f87444d2b15c7884cab8/nix/deploy.nix |
Unfortunately I do not know deploy-rs, but you can use the |
Hello, I did a deploy script before finding this issue The script rely on SSH
|
Managed deploying with deploy-rs, though I'm pretty sure the rollback isn't working exactly as intended. Feel free to add this to the wiki. Solution for Deploying Using
|
nix-on-droid.pkgs vs isAndroid
|
This is working great with the instructions from @geoffreygarrett!
|
Added the instructions to the wiki and also included the configuration needed to build aarch64 from other architectures: https://github.com/nix-community/nix-on-droid/wiki/Remote-deploy-with-deploy%E2%80%90rs I think the issue can be closed with this? |
https://github.com/serokell/deploy-rs
https://github.com/Infinisil/nixus
Those tools allow us to build multiples machines at once and push deploy them.
If I can build aarch64, can I just build something, nix-copy it to the phone and run an
activate
command on the phone?The text was updated successfully, but these errors were encountered: