diff options
author | Arseniy Seroka <jagajaga@users.noreply.github.com> | 2015-05-14 22:44:43 +0300 |
---|---|---|
committer | Arseniy Seroka <jagajaga@users.noreply.github.com> | 2015-05-14 22:44:43 +0300 |
commit | 946e7dca610450886e08a408144cf694aa9beb77 (patch) | |
tree | 1b5409f570b740e83c4a0eb71fc5f69db29f4d0d /nixos/modules/services/networking | |
parent | 1194ebc7eff3797c25e1b0c0eed9bc0b1d627365 (diff) | |
parent | fd8cb1ff2d53cad7fee74e2db73d1f01056a964d (diff) | |
download | nixlib-946e7dca610450886e08a408144cf694aa9beb77.tar nixlib-946e7dca610450886e08a408144cf694aa9beb77.tar.gz nixlib-946e7dca610450886e08a408144cf694aa9beb77.tar.bz2 nixlib-946e7dca610450886e08a408144cf694aa9beb77.tar.lz nixlib-946e7dca610450886e08a408144cf694aa9beb77.tar.xz nixlib-946e7dca610450886e08a408144cf694aa9beb77.tar.zst nixlib-946e7dca610450886e08a408144cf694aa9beb77.zip |
Merge pull request #7842 from dezgeg/pr-nix-serve
nix-serve: Add nixos module
Diffstat (limited to 'nixos/modules/services/networking')
-rw-r--r-- | nixos/modules/services/networking/nix-serve.nix | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/nixos/modules/services/networking/nix-serve.nix b/nixos/modules/services/networking/nix-serve.nix new file mode 100644 index 000000000000..c2c579c3177e --- /dev/null +++ b/nixos/modules/services/networking/nix-serve.nix @@ -0,0 +1,56 @@ +{ config, pkgs, lib, ... }: + +with lib; + +let + cfg = config.services.nix-serve; +in +{ + options = { + services.nix-serve = { + enable = mkEnableOption "nix-serve, the standalone Nix binary cache server"; + + port = mkOption { + type = types.int; + default = 5000; + description = '' + Port number where nix-serve will listen on. + ''; + }; + + bindAddress = mkOption { + type = types.string; + default = "0.0.0.0"; + description = '' + IP address where nix-serve will bind its listening socket. + ''; + }; + + extraParams = mkOption { + type = types.string; + default = ""; + description = '' + Extra command line parameters for nix-serve. + ''; + }; + }; + }; + + config = mkIf cfg.enable { + systemd.services.nix-serve = { + description = "nix-serve binary cache server"; + after = [ "network.target" ]; + wantedBy = [ "multi-user.target" ]; + + path = [ config.nix.package pkgs.bzip2 ]; + environment.NIX_REMOTE = "daemon"; + + serviceConfig = { + ExecStart = "${pkgs.nix-serve}/bin/nix-serve " + + "--port ${cfg.bindAddress}:${toString cfg.port} ${cfg.extraParams}"; + User = "nobody"; + Group = "nogroup"; + }; + }; + }; +} |