diff options
author | Matt McHenry <github@matt.mchenryfamily.org> | 2016-09-05 17:59:25 -0400 |
---|---|---|
committer | Joachim Fasting <joachifm@fastmail.fm> | 2016-09-23 16:08:03 +0200 |
commit | de9546307fdf8c2b34796b78791777246679124e (patch) | |
tree | f4faab9d600b4ac41ba2dfa2d60783f5d7134d6e /nixos | |
parent | 5f0302b4a1aeda4f2b1975e179e3d1a3c2bae1c8 (diff) | |
download | nixpkgs-de9546307fdf8c2b34796b78791777246679124e.tar nixpkgs-de9546307fdf8c2b34796b78791777246679124e.tar.gz nixpkgs-de9546307fdf8c2b34796b78791777246679124e.tar.bz2 nixpkgs-de9546307fdf8c2b34796b78791777246679124e.tar.lz nixpkgs-de9546307fdf8c2b34796b78791777246679124e.tar.xz nixpkgs-de9546307fdf8c2b34796b78791777246679124e.tar.zst nixpkgs-de9546307fdf8c2b34796b78791777246679124e.zip |
nix-optimise service: init
Closes https://github.com/NixOS/nixpkgs/pull/18378
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/modules/module-list.nix | 1 | ||||
-rw-r--r-- | nixos/modules/services/misc/nix-optimise.nix | 49 |
2 files changed, 50 insertions, 0 deletions
diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index a3bbddfcdd2..07da64c6384 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -250,6 +250,7 @@ ./services/misc/mwlib.nix ./services/misc/nix-daemon.nix ./services/misc/nix-gc.nix + ./services/misc/nix-optimise.nix ./services/misc/nixos-manual.nix ./services/misc/nix-ssh-serve.nix ./services/misc/nzbget.nix diff --git a/nixos/modules/services/misc/nix-optimise.nix b/nixos/modules/services/misc/nix-optimise.nix new file mode 100644 index 00000000000..fea322a68f8 --- /dev/null +++ b/nixos/modules/services/misc/nix-optimise.nix @@ -0,0 +1,49 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + cfg = config.nix.optimise; +in + +{ + + ###### interface + + options = { + + nix.optimise = { + + automatic = mkOption { + default = false; + type = types.bool; + description = "Automatically run the nix store optimiser at a specific time."; + }; + + dates = mkOption { + default = "03:45"; + type = types.listOf types.str; + description = '' + Specification (in the format described by + <citerefentry><refentrytitle>systemd.time</refentrytitle> + <manvolnum>5</manvolnum></citerefentry>) of the time at + which the optimiser will run. + ''; + }; + }; + }; + + + ###### implementation + + config = { + + systemd.services.nix-optimise = + { description = "Nix Store Optimiser"; + serviceConfig.ExecStart = "${config.nix.package}/bin/nix-store --optimise"; + startAt = optional cfg.automatic cfg.dates; + }; + + }; + +} |