diff options
author | Jakob Gillich <jakob@gillich.me> | 2015-12-09 05:46:02 +0100 |
---|---|---|
committer | Jakob Gillich <jakob@gillich.me> | 2015-12-11 05:53:20 +0100 |
commit | c85ada394f495f3a7277253896ecb584dde8d496 (patch) | |
tree | 5ab6d456b1d7c5f7d2ee99a81104eb5e50a4c175 /nixos | |
parent | 2838161c2107f350f75120cc0c61c4ebb8901052 (diff) |
rkt: add service
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/modules/module-list.nix | 1 | ||||
-rw-r--r-- | nixos/modules/virtualisation/rkt.nix | 62 |
2 files changed, 63 insertions, 0 deletions
diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index 9fc1d54bd8425..9bd35ded039c4 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -507,6 +507,7 @@ ./virtualisation/amazon-options.nix ./virtualisation/openvswitch.nix ./virtualisation/parallels-guest.nix + ./virtualisation/rkt.nix ./virtualisation/virtualbox-guest.nix ./virtualisation/virtualbox-host.nix ./virtualisation/vmware-guest.nix diff --git a/nixos/modules/virtualisation/rkt.nix b/nixos/modules/virtualisation/rkt.nix new file mode 100644 index 0000000000000..7b4d46e0749e6 --- /dev/null +++ b/nixos/modules/virtualisation/rkt.nix @@ -0,0 +1,62 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + cfg = config.virtualisation.rkt; +in +{ + options.virtualisation.rkt = { + enable = mkEnableOption "rkt metadata service"; + + gc = { + automatic = mkOption { + default = true; + type = types.bool; + description = "Automatically run the garbage collector at a specific time."; + }; + + dates = mkOption { + default = "03:15"; + type = types.str; + description = '' + Specification (in the format described by + <citerefentry><refentrytitle>systemd.time</refentrytitle> + <manvolnum>5</manvolnum></citerefentry>) of the time at + which the garbage collector will run. + ''; + }; + + options = mkOption { + default = "--grace-period=24h"; + type = types.str; + description = '' + Options given to <filename>rkt gc</filename> when the + garbage collector is run automatically. + ''; + }; + }; + }; + + config = mkIf cfg.enable { + environment.systemPackages = [ pkgs.rkt ]; + + systemd.services.rkt = { + description = "rkt metadata service"; + wantedBy = [ "multi-user.target" ]; + after = [ "network.target" ]; + serviceConfig = { + ExecStart = "${pkgs.rkt}/bin/rkt metadata-service"; + }; + }; + + systemd.services.rkt-gc = { + description = "rkt garbage collection"; + startAt = optionalString cfg.gc.automatic cfg.gc.dates; + serviceConfig = { + Type = "oneshot"; + ExecStart = "${pkgs.rkt}/bin/rkt gc ${cfg.gc.options}"; + }; + }; + }; +} |