8000 Unnecessary sudo in: `sudo nixos-rebuild --use-remote-sudo <...>` · Issue #41 · krebs/krops · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Unnecessary sudo in: sudo nixos-rebuild --use-remote-sudo <...> #41
Open
@nicdumz

Description

@nicdumz

Heya,

Starting from a trivial deployment:

let
  krops = (import <nixpkgs> {}).fetchgit {
   url = "https://github.com/krebs/krops";
   sha256 = "sha256-GJ9NKBNIhT7Ui2q4HJ0zJ2fgd9oiPDS1Zzo2p0RpQ1A=";
  };
  lib = import "${krops}/lib";
  pkgs = import "${krops}/pkgs" {};
in
  pkgs.krops.writeDeploy "deploy" {
    source = {};
    target = lib.mkTarget "foo@host" // { sudo = true; };
  }

This produces:

#! /nix/store/b1z95il7pg7i2kmk6fi3j57r770c37y2-dash-0.5.12/bin/dash
exec /nix/store/c1zb4lfggv7gn3rcjyqzf6ivgr5gwxyl-openssh-9.9p1/bin/ssh -l foo -T host 'sudo \
/bin/sh -c '\''printf '\''\'\'''\''# use nix-output-monitor: %s\n'\''\'\'''\'' opportunistic >&2
if command -v nom >/dev/null; then
  (NIX_PATH=/var/src \
nixos-rebuild switch --use-remote-sudo
) 2>&1 | nom

else
  NIX_PATH=/var/src \
nixos-rebuild switch --use-remote-sudo

fi

'\''
'

My understanding is that sudo nix-rebuild switch --use-remote-sudo is actually non-ideal form (see https://nixos.org/manual/nixos/stable/index.html#sec-changing-config) and that nix-rebuild switch --use-remote-sudo would be preferred.

Is there a reason for it, or should we change krops to drop the leading sudo in this situation?

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0