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

WIP nixos/nix-daemon: Organize buildMachine options with a submodule #47636

Closed

Conversation

Ericson2314
Copy link
Member

Motivation for this change

What's the best way to test this sort of thing?

nixos-option -I nixpkgs=(pwd) nix.buildMachines.foo.bar

did not work for example.

Also, is this reasonable for 18.09 or is that fact that garbage attributes will be rejected a problem?

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Fits CONTRIBUTING.md.

@grahamc
Copy link
Member

grahamc commented Oct 2, 2018

Too late for 18.09, but I like the idea.

@Ericson2314
Copy link
Member Author

@grahamc my other idea was to check if types.either types.attrs (types.submodule ..) would work to provide documentation but make no errors.

default = "-";
description = ''
The path to the SSH private key with which to authenticate with
the build machine. <literal>"-"</literal> indicates falling back
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably should either drop the " or at least move the quote out of the literal element.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I mean the quote to be there to show the Nix literal one would write, rather than string literal, leaving it to the literal to figure out that - only makes sense as a string.

default = 1;
description = ''
Something at indicates how fast the machine is relative to an
arbitrary norm???
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An arbitrary integer to indicate the build performance of this system relative to the other buildMachines.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... higher|lower is faster.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

might be best to use unsigned/ints.between 0 100/positive as type.

decriptions = ''
A list of features derivations built with this remote may choose
to use or not. (See the documentation on Nix itself for what
those features are.)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you mean by the above parentheticals?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was hoping somewhere else might actually list valid features, but https://nixos.org/nix/manual/#chap-distributed-builds again just says they exist, other than the "kvm" example.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, there is no list of valid features. You can make them up. I have a machine with the feature "big-mistake-this-ones-impure".

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh haha

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a grep on nixpkgs gives "big-parallel"/"kvm"/"benchmark"/"nixos-test". Even if it stays freefrom, it would be nice to list the default ones with a types.either( enum [ "kvm" ... ] or string).

hostName = mkOption {
type = types.string;
description = ''
The hostname of the build machine.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe note this hostname has to resolve.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what good can be hostname that doesn't resolve ?

type = types.listOf types.string;
default = [];
description = ''
The system types the build machine can execute derivations on.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about some examples on the above two?

@Ericson2314
Copy link
Member Author

Thanks @grahamc, I'll fix these later tonight.

@mmahut
Copy link
Member

mmahut commented Aug 25, 2019

Are there any updates on this pull request, please?

@teto
Copy link
Member

teto commented Aug 26, 2019

may be ok for 19.09. I can test once the patch is fixed.

@ivan
Copy link
Member

ivan commented Sep 6, 2019

For the author, reviewers, and committers: this PR was scanned and appears to add a use of the deprecated types.string, which emits a warning as of #66346. Before merging, please change this to another type, possibly:

  • types.str for a single string where merging does not make sense, or cannot work
  • types.lines for multi-line configuration or scripts where merging is possible
  • types.listOf types.str for a mergeable list of strings

};
sshKey = mkOption {
type = types.string;
default = "-";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because of #69900, it would be a good idea to force this option to not have a value from the store. This can be done with an apply = toString

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't enough to guarantee this at all actually. See #78640 for a better way in the future. For now this should be just types.str

'';
};
system = mkOption {
type = types.string;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should use "nullOr"

@infinisil
Copy link
Member

#83104 is an updated version of this, closing

@infinisil infinisil closed this May 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants