git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #11565 from jgillich/rkt

rkt: add service

commit79d0fc45a9c72875a9907a20135351ba9169b51d authorArseniy Seroka <jagajaga@users.noreply.github.com> dateFri 11 Dec 2015, 08:04 (11 years ago) parentebab509c85ada3
2 files changed+63
nixos/modules/module-list.nix+1 nixos/modules/virtualisation/rkt.nix+62
nixos/modules/module-list.nix+1
@@ -508,6 +508,7 @@
508508 ./virtualisation/amazon-options.nix
509509 ./virtualisation/openvswitch.nix
510510 ./virtualisation/parallels-guest.nix
511+ ./virtualisation/rkt.nix
511512 ./virtualisation/virtualbox-guest.nix
512513 ./virtualisation/virtualbox-host.nix
513514 ./virtualisation/vmware-guest.nix
nixos/modules/virtualisation/rkt.nixnew file+62
@@ -0,0 +1,62 @@
1+{ config, lib, pkgs, ... }:
2+
3+with lib;
4+
5+let
6+ cfg = config.virtualisation.rkt;
7+in
8+{
9+ options.virtualisation.rkt = {
10+ enable = mkEnableOption "rkt metadata service";
11+
12+ gc = {
13+ automatic = mkOption {
14+ default = true;
15+ type = types.bool;
16+ description = "Automatically run the garbage collector at a specific time.";
17+ };
18+
19+ dates = mkOption {
20+ default = "03:15";
21+ type = types.str;
22+ description = ''
23+ Specification (in the format described by
24+ <citerefentry><refentrytitle>systemd.time</refentrytitle>
25+ <manvolnum>5</manvolnum></citerefentry>) of the time at
26+ which the garbage collector will run.
27+ '';
28+ };
29+
30+ options = mkOption {
31+ default = "--grace-period=24h";
32+ type = types.str;
33+ description = ''
34+ Options given to <filename>rkt gc</filename> when the
35+ garbage collector is run automatically.
36+ '';
37+ };
38+ };
39+ };
40+
41+ config = mkIf cfg.enable {
42+ environment.systemPackages = [ pkgs.rkt ];
43+
44+ systemd.services.rkt = {
45+ description = "rkt metadata service";
46+ wantedBy = [ "multi-user.target" ];
47+ after = [ "network.target" ];
48+ serviceConfig = {
49+ ExecStart = "${pkgs.rkt}/bin/rkt metadata-service";
50+ };
51+ };
52+
53+ systemd.services.rkt-gc = {
54+ description = "rkt garbage collection";
55+ startAt = optionalString cfg.gc.automatic cfg.gc.dates;
56+ serviceConfig = {
57+ Type = "oneshot";
58+ ExecStart = "${pkgs.rkt}/bin/rkt gc ${cfg.gc.options}";
59+ };
60+ };
61+ };
62+}