Skip to content

Rfc htpdate #18818

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

Merged
merged 2 commits into from
Sep 23, 2016
Merged

Rfc htpdate #18818

merged 2 commits into from
Sep 23, 2016

Conversation

Jookia
Copy link
Contributor

@Jookia Jookia commented Sep 21, 2016

Motivation for this change

This PR adds the htpdate utility as well as a NixOS service to run it as a daemon.

Things done
  • Tested using sandboxing
  • Built on platform(s)
    • NixOS
    • OS X
    • Linux
  • 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/)
  • Fits CONTRIBUTING.md.

@mention-bot
Copy link

@Jookia, thanks for your PR! By analyzing the annotation information on this pull request, we identified @edolstra, @bjornfor and @offlinehacker to be potential reviewers

@Jookia
Copy link
Contributor Author

Jookia commented Sep 21, 2016

(Oops, forgot to fix the title before posting. Sorry!)

Type = "forking";
PIDFile = "/var/run/htpdate.pid";
ExecStart = concatStringsSep " " [
"${htpdate}/bin/htpdate"
Copy link
Contributor

@the-kenny the-kenny Sep 21, 2016

Choose a reason for hiding this comment

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

Nix has multiline-strings via ''

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Multiline strings don't work for this, the alternate way is one very lone line.

Copy link
Contributor

@cstrahan cstrahan Sep 23, 2016

Choose a reason for hiding this comment

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

@Jookia Something like this should work:

ExecStart = ''
  blah \
  foo \
  bar
''

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Neat

config = mkIf cfg.enable {

# Make tools such as htpdate available in the system path
environment.systemPackages = [ htpdate ];
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it necessary to make the package available to the user? It's generally better to put as little as possible there. Of course it's justified if the tool is expected to be called by the user (for example to control the daemon)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed!

meta = {
description = "Utility to fetch time and set the system clock over HTTP";
homepage = http://www.vervest.org/htp/;
platforms = stdenv.lib.platforms.all;
Copy link
Contributor

Choose a reason for hiding this comment

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

The build fails on darwin because it calls out to gcc. You could try making it use cc instead, assuming the package doesn't actually depend on gcc specifics.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed, if you're on Darwin could you try building?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nevermind, Travis CI concludes that there's no sys/timex header which OS X doesn't have. Setting to just linux.

@LnL7 LnL7 added 8.has: package (new) This PR adds a new package 8.has: module (new) This PR adds a module in `nixos/` labels Sep 21, 2016
};

extraOptions = mkOption {
type = types.string;
Copy link
Contributor

Choose a reason for hiding this comment

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

types.str is more appropriate for plain strings, string has potentially surprising merge semantics and is deprecated.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed them all to types.str.

@joachifm joachifm merged commit 7529fd3 into NixOS:master Sep 23, 2016
@joachifm
Copy link
Contributor

Thank you

@nbp nbp mentioned this pull request Feb 26, 2017
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
8.has: module (new) This PR adds a module in `nixos/` 8.has: package (new) This PR adds a new package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants