mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-29 00:53:57 +00:00
c57a434386
It doesn't really make sense for us as team members are focused on different things. At the end of the day it's the individuals that do the work.
56 lines
1.4 KiB
Nix
56 lines
1.4 KiB
Nix
{ config, pkgs, lib, ... }:
|
|
|
|
with lib;
|
|
let
|
|
cfg = config.services.nar-serve;
|
|
in
|
|
{
|
|
meta = {
|
|
maintainers = [ maintainers.rizary maintainers.zimbatm ];
|
|
};
|
|
options = {
|
|
services.nar-serve = {
|
|
enable = mkEnableOption (lib.mdDoc "serving NAR file contents via HTTP");
|
|
|
|
port = mkOption {
|
|
type = types.port;
|
|
default = 8383;
|
|
description = lib.mdDoc ''
|
|
Port number where nar-serve will listen on.
|
|
'';
|
|
};
|
|
|
|
cacheURL = mkOption {
|
|
type = types.str;
|
|
default = "https://cache.nixos.org/";
|
|
description = lib.mdDoc ''
|
|
Binary cache URL to connect to.
|
|
|
|
The URL format is compatible with the nix remote url style, such as:
|
|
- http://, https:// for binary caches via HTTP or HTTPS
|
|
- s3:// for binary caches stored in Amazon S3
|
|
- gs:// for binary caches stored in Google Cloud Storage
|
|
'';
|
|
};
|
|
};
|
|
};
|
|
|
|
config = mkIf cfg.enable {
|
|
systemd.services.nar-serve = {
|
|
description = "NAR server";
|
|
after = [ "network.target" ];
|
|
wantedBy = [ "multi-user.target" ];
|
|
|
|
environment.PORT = toString cfg.port;
|
|
environment.NAR_CACHE_URL = cfg.cacheURL;
|
|
|
|
serviceConfig = {
|
|
Restart = "always";
|
|
RestartSec = "5s";
|
|
ExecStart = "${pkgs.nar-serve}/bin/nar-serve";
|
|
DynamicUser = true;
|
|
};
|
|
};
|
|
};
|
|
}
|