serokell / deploy-rs

A simple multi-profile Nix-flake deploy tool.
Other
1.31k stars 100 forks source link

Can't figure out how to use some overlays when deploying to nix-on-droid with deploy-rs #92

Closed bbigras closed 3 years ago

bbigras commented 3 years ago

I'm using something like this to deploy to nix-on-droid with deploy-rs, but I can't figure out how to add some overlays.

I would guess that in my case, deploy-rs is just deploying the profile that I'm building myself, so maybe it has nothing to do with deploy-rs.

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/t184256/nix-on-droid/issues/94#issuecomment-850849580

notgne2 commented 3 years ago

I think the problem here is with the flake.nix in nix-on-droid, it passes pkgs which is just nixpkgs.legacyPackages.${system}, and has seemingly no way to override it, in my opinion it might make more sense to have pkgs = import nixpkgs { inherit system; overlays = self.overlays; }; instead, then in the deploy-rs configuration you wouldn't need to change anything. Alternatively, you could make it take pkgs as an argument and pass that from your deploy-rs configuration.

note: the example I gave won't work because self.overlays won't exist, you should move it to not be under flake-utils.lib.eachSystem, see the output schema on https://nixos.wiki/wiki/Flakes

notgne2 commented 3 years ago

Also in other activations including those built-in to deploy-rs, we would do $PROFILE/activate instead, I don't think that's going to change anything in your case though

bbigras commented 3 years ago

Thanks. I think I was able to fix it with https://github.com/t184256/nix-on-droid/pull/119/commits/df4173c9345bc7419f5f173b4f3bb38fd4a05d1c