Skip to content
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

[Question] remoteBuild has no effect, still build locally. #300

Closed
amalgame21 opened this issue Nov 13, 2024 · 3 comments
Closed

[Question] remoteBuild has no effect, still build locally. #300

amalgame21 opened this issue Nov 13, 2024 · 3 comments

Comments

@amalgame21
Copy link

amalgame21 commented Nov 13, 2024

I used remoteBuild = true; but it still build on local machine.
same as --remote-build flag.
I configure the flake like this:

{
  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05";
    deploy-rs.url = "github:serokell/deploy-rs";
  };
  outputs = { self, nixpkgs, deploy-rs, ... } @ inputs: {
    nixosConfigurations = {
      remotelaptop = nixpkgs.lib.nixosSystem {
        # ...
      };
      # ...
    };

    deploy.nodes = {
      "remotelaptop" = {
        hostname = "l"; # hostname in ~/.ssh/config
        interactiveSudo = true;
        remoteBuild = true;
        profiles.system = {
          user = "root";
          sshUser = "normaluser";
          path = deploy-rs.lib.x86_64-linux.activate.nixos self.nixosConfigurations."remotelaptop";
        };
      };
    };
    # This is highly advised, and will prevent many possible mistakes
    checks = builtins.mapAttrs (system: deployLib: deployLib.deployChecks self.deploy) deploy-rs.lib;
  };
}

I am very new to deploy-rs, this is the first deploy system I use after I switch to nixos.
Usually I just ssh into the remote system and run nixos-rebuild switch, which is quite demanding.
I have no experience to deploy remote machine like this, even the nixos-rebuild --target-host --build-host command (Not using it because it seem not supporting sudo with password)
Does it require some additional settings like nix.settings.trusted-user ? Thanks!

@amalgame21
Copy link
Author

amalgame21 commented Nov 13, 2024

I am using gpg key protected by password (gpg-agent) as ssh key
https://wiki.archlinux.org/title/GnuPG#SSH_agent

programs.gnupg.agent = {
  enable = true;
  enableSSHSupport = true;
};

Is it the problem?

@amalgame21
Copy link
Author

Seems it is caused by the nixpkgs.hostPlatform and nixpkgs.buildPlatform

#200 (comment)

deploy-rs is so hard to use imho, documentation seems incomplete.

@nikp123
Copy link

nikp123 commented Dec 16, 2024

deploy-rs is so hard to use imho, documentation seems incomplete.

I know this is off-topic: But have you found any alternatives? NixOps just seems deprecated, and the other solutions don't seem that popular.

Currently I invoke nixos-rebuild for every machine that I manage which quickly gets tiresome.

Reason: I'm running into the same issue of everything being built locally instead on the target machines which just fills up my hard drive space pointlessly and costs obscene amounts of bandwidth due to garbage collection.

Ideally it should behave like the following command:

nixos-rebuild \
      --build-host root@NSServer \
      --target-host root@NSServer \
      --flake .#NSServer \
      --use-substitutes \
      --option builders-use-substitutes true \
      switch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants