-
-
Notifications
You must be signed in to change notification settings - Fork 14.2k
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] One way to do other types of services #26075
Conversation
@copumpkin, thanks for your PR! By analyzing the history of the files in this pull request, we identified @edolstra, @bjornfor and @offlinehacker to be potential reviewers. |
inherit script; | ||
}; | ||
|
||
docker-containers.hologram-server = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could probably abstract many basic simple services like this with a simple function to automatically do docker-containers
, trivial-services
, and maybe even systemd.services
. The autogenerated config could then be merged with idiosyncratic config for any of those.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if we should put those options into the top-level but I love the basic idea!
serviceConfig = { | ||
ExecStart = "${pkgs.hologram.bin}/bin/hologram-server --debug --conf ${cfgFile}"; | ||
}; | ||
inherit script; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would keep serviceConfig.ExecStart = script;
as direct commands are more transparent to the user (ex: there are visible in systemctl status). Otherwise the user has to look at the content of the script file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For my launchd modules I added command
which defaults to a writeScript if a script is defined.
My main question for feedback is how do we expose this sort of thing? I was thinking of something like the following: {
dockerServices = config: (import ./nixos/lib/eval-config.nix {
modules = [ config ];
}).config.system.build.toplevel-docker;
} But it feels a bit awkward to then stick I imagine Another question is how to warn people if they decide to specify useless config in there. Someone could write |
What is the status of this pull request? |
Closing due to lack of activity, feel free re-open this if needed. |
Motivation for this change
See #26067. Not quite sure how to expose this, and I'd be tempted to move the service modules out of the
nixos
folder if this catches on.Here's how I use it:
Then just
nix-build
that and you get a runner script that launches your service on any platform supported by the package.Also,
toplevel-docker
will contain as manydockerTools
-style containers as your config has docker-flavored services enabled.