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

pixiecore: initial commit #62113

Closed
wants to merge 4 commits into from
Closed

pixiecore: initial commit #62113

wants to merge 4 commits into from

Conversation

RaunoVV
Copy link

@RaunoVV RaunoVV commented May 27, 2019

Motivation for this change

Initial commit for pixiecore tool: https://github.com/danderson/netboot/tree/master/pixiecore

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 nix-review --run "nix-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)
  • Assured whether relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@Lassulus
Copy link
Member

can we have seperate commits for the service and the package? Also the merge commit is kinda unnecessary

Copy link
Member

@aanderse aanderse left a comment

Choose a reason for hiding this comment

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

Please let me know if you have any questions or need any help.

nixos/modules/services/networking/pixiecore.nix Outdated Show resolved Hide resolved
nixos/modules/services/networking/pixiecore.nix Outdated Show resolved Hide resolved
nixos/modules/services/networking/pixiecore.nix Outdated Show resolved Hide resolved
nixos/modules/services/networking/pixiecore.nix Outdated Show resolved Hide resolved
nixos/modules/services/networking/pixiecore.nix Outdated Show resolved Hide resolved
nixos/modules/services/networking/pixiecore.nix Outdated Show resolved Hide resolved
pkgs/tools/networking/pixiecore/default.nix Show resolved Hide resolved
nixos/modules/services/networking/pixiecore.nix Outdated Show resolved Hide resolved
@RaunoVV
Copy link
Author

RaunoVV commented May 28, 2019

Thank you for the feedback. Will resolve all those today and resubmit! Should it be new clean pullrequest, right?

@Lassulus
Copy link
Member

You can just amend your commits and force-push to the same branch again

@aanderse
Copy link
Member

Please do a rebase and then you can avoid the merge in your git history as well. Let us know if you need any help.

Copy link
Member

@aanderse aanderse left a comment

Choose a reason for hiding this comment

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

Please rewrite your git history.

description = "Log more things that aren't directly related to booting a recognized client";
};

logTimestamps = mkOption {
Copy link
Member

Choose a reason for hiding this comment

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

If this is logging to syslog then won't time stamps always be added anyways? If this is true will there be 2 timestamps for every entry?


bootMsg = mkOption {
type = types.nullOr 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.

Maybe default should be null.

Copy link
Member

Choose a reason for hiding this comment

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

Looks like this option is never actually used, so I'd vote for just deleting the mkOption block.

Copy link
Member

Choose a reason for hiding this comment

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

Good catch.

};

port = mkOption {
type = types.int;
Copy link
Member

Choose a reason for hiding this comment

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

There is a port type.

};

statusPort = mkOption {
type = types.int;
Copy link
Member

Choose a reason for hiding this comment

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

There is a port type.

@@ -0,0 +1,26 @@
{ stdenv, buildGoPackage, fetchgit, fetchhg, fetchbzr, fetchsvn }:

Copy link
Member

Choose a reason for hiding this comment

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

As mentioned name is no longer required.


cmdLine = mkOption {
type = types.nullOr 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.

Again, maybe null is more appropriate default.

Copy link
Member

Choose a reason for hiding this comment

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

Having it be types.string (without nullOr and default = "" would make more sense to me, unless no command line should be different from an empty command line.

(Also note that as currently implemented the --cmdline argument is passed iff cmdLine is not "", so it'll be passed if it's null and this will probably break)

PIDFile="/run/pixiecore.pid";
DynamicUser="yes";
AmbientCapabilities = "cap_net_bind_service";
ExecStart = "${pkgs.pixiecore}/bin/pixiecore boot ${cfg.kernel} ${cfg.initrd} ${optionalString (cfg.cmdLine != "") "--cmdline=\\\'${cfg.cmdLine}\\\'"} ${optionalString cfg.debug "--debug"} ${optionalString cfg.logTimestamps "--log-timestamps"} ${optionalString cfg.dhcpNoBind "--dhcp-no-bind"} ${optionalString (cfg.listen != "") "--listen-addr ${cfg.listen}"} ${optionalString (cfg.port != 0) "--port ${toString cfg.port}"} ${optionalString (cfg.statusPort!= 0) "--status-port ${toString cfg.statusPort}"}";
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
ExecStart = "${pkgs.pixiecore}/bin/pixiecore boot ${cfg.kernel} ${cfg.initrd} ${optionalString (cfg.cmdLine != "") "--cmdline=\\\'${cfg.cmdLine}\\\'"} ${optionalString cfg.debug "--debug"} ${optionalString cfg.logTimestamps "--log-timestamps"} ${optionalString cfg.dhcpNoBind "--dhcp-no-bind"} ${optionalString (cfg.listen != "") "--listen-addr ${cfg.listen}"} ${optionalString (cfg.port != 0) "--port ${toString cfg.port}"} ${optionalString (cfg.statusPort!= 0) "--status-port ${toString cfg.statusPort}"}";
ExecStart = "${pkgs.pixiecore}/bin/pixiecore boot ${cfg.kernel} ${cfg.initrd} --cmdline='${cfg.cmdLine}' ${optionalString cfg.debug "--debug"} ${optionalString cfg.logTimestamps "--log-timestamps"} ${optionalString cfg.dhcpNoBind "--dhcp-no-bind"} --listen-addr '${cfg.listen}' --port ${toString cfg.port} --status-port ${toString cfg.statusPort}";

Unless --cmdline "" is different from no --cmdline argument. (Also note that as currently written I think you have one too many escapes here, which would not get triggered when staying at the default --cmdline though)

Similarly, cfg.listen already defaults to 0.0.0.0, so it can just always be passed. And same for cfg.port/statusPort, as they're already set to the pixiecore default, they can just be always passed. (not sure whether there's necessarily a status port, though? in which case it should be of type nullOr port and not be passed when null -- not when 0).

Sure it's hardcoding the defaults of pixiecore into the module, but it sounds better to me to just have the whole thing simpler.

Oh, and it's a really long line even with the suggested changes, so you may want to break it over multiple lines -- for instance by closing the NixOS string and opening it again.

@@ -24181,4 +24181,6 @@ in

dapper = callPackage ../development/tools/dapper { };

pixiecore = callPackage ../tools/networking/pixiecore {};
Copy link
Member

Choose a reason for hiding this comment

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

This is not the right place, it should go under the ### TOOLS heading (a good trick is to grep for tools/networking and place it close to a match)

Copy link
Member

@Ekleog Ekleog left a comment

Choose a reason for hiding this comment

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

@RaunoVV Courage! You're almost there, we know it's a lot of feedback to handle… but sorry, you started directly with a package+module, so you get all the feedback you'd normally get over the course of several PRs spread over weeks or months :p So courage! The PR should soon be ready :)

@aanderse
Copy link
Member

aanderse commented Sep 1, 2019

@RaunoVV do you have any motivation to continue with this PR?

@RaunoVV
Copy link
Author

RaunoVV commented Sep 1, 2019

@aanderse thx for the mention. I'll try to finish it this week. Totally forgot to finish this..

@Ekleog thx, ill do it 🙂

@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

@bbigras
Copy link
Contributor

bbigras commented Jan 20, 2020

I'm looking forward for this module. Any progress on it?

This was referenced Mar 25, 2020
@Mic92
Copy link
Member

Mic92 commented Apr 2, 2020

added in #83373

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