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

Support deploying from macOS without configuring remote builders #167

Open
misuzu opened this issue Jul 31, 2022 · 5 comments
Open

Support deploying from macOS without configuring remote builders #167

misuzu opened this issue Jul 31, 2022 · 5 comments

Comments

@misuzu
Copy link

misuzu commented Jul 31, 2022

This could be achieved by passing --eval-store auto --store ssh-ng://builder to nix build (where builder is a target host). Currently it is impossible.

@PhilTaken
Copy link
Collaborator

Can you try #175 and see if that solves your issue?

@gdinh
Copy link

gdinh commented Nov 23, 2022

I haven't been able to get it to work with remote builders.

Flake:

{

  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-22.05-darwin";
    nixpkgs-unstable.url = "github:nixos/nixpkgs/nixpkgs-unstable";

    darwin.url = "github:lnl7/nix-darwin/master";
    darwin.inputs.nixpkgs.follows = "nixpkgs";

    home-manager.url = "github:nix-community/home-manager/release-22.05";
    home-manager.inputs.nixpkgs.follows = "nixpkgs";

    deploy-rs.url = "github:serokell/deploy-rs";
    deploy-rs.inputs.nixpkgs.follows = "nixpkgs";
  };

  outputs = { self, darwin, nixpkgs, nixpkgs-unstable, home-manager, deploy-rs, ... }: {

    nixosConfigurations.sb = nixpkgs.lib.nixosSystem {
      system = "x86_64-linux";
      modules = [ ./hosts/sb/configuration.nix ];
    };

    deploy.nodes.sb = {
      sshUser = "grace";
      hostname = "192.168.86.64";
      remoteBuild = true;
      profilesOrder = [ "system" ];
      profiles.system = {
        remoteBuild = true;
        path = deploy-rs.lib.x86_64-linux.activate.nixos self.nixosConfigurations.sb;
      };
    };

    deploy = {
      magicRollback = true;
      autoRollback = true;
      remoteBuild = true;
    };
    checks = builtins.mapAttrs (system: deployLib: deployLib.deployChecks self.deploy) deploy-rs.lib;
  };
}

Output:

╰─ result/bin/deploy .#sb --remote-build -d
🚀 ❓ [deploy] [DEBUG] Checking for flake support
🚀 ℹ️ [deploy] [INFO] Running checks for flake in .
warning: Git tree '/Users/grace/.config/gnix' is dirty
warning: unknown flake output 'darwinConfigurations'
warning: unknown flake output 'darwinPackages'
warning: unknown flake output 'deploy'
error: a 'x86_64-linux' with features {} is required to build '/nix/store/lpwa4l59sgjbfyngc282p2yldim9fd6y-builder.pl.drv', but I am a 'aarch64-darwin' with features {benchmark, big-parallel, nixos-test}
🚀 ❌ [deploy] [ERROR] Failed to check deployment: Nix checking command resulted in a bad exit code: Some(1)

@gdinh
Copy link

gdinh commented Nov 24, 2022

Update: it seems that this line is causing the issue

checks = builtins.mapAttrs (system: deployLib: deployLib.deployChecks self.deploy) deploy-rs.lib;

Since the checks are evaluated locally, evaluating them requires building nixosConfigurations locally as well, which gives the bug seen above. Removing it fixes the problem.

Is there a way to run the checks remotely as well?

Thanks!

@PhilTaken
Copy link
Collaborator

PhilTaken commented Nov 24, 2022

Since the checks are evaluated locally, evaluating them requires building nixosConfigurations locally as well, which gives the bug seen above. Removing it fixes the problem.

That is expected behaviour; remote testing, should be added to remoteBuild honestly.

@ketan-vijayvargiya
Copy link

ketan-vijayvargiya commented Jan 19, 2024

Since the checks are evaluated locally, evaluating them requires building nixosConfigurations locally as well, which gives the bug seen above. Removing it fixes the problem.

Thanks for the tip - it works.

I do see this in the comments:

This is highly advised, and will prevent many possible mistakes

What's the worst case scenario if we remove those checks (until, hopefully, the problem is fixed)?

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

4 participants