9 cfg = config.services.zerobin;
11 zerobin_config = pkgs.writeText "zerobin-config.py" ''
12 PASTE_FILES_ROOT = "${cfg.dataDir}"
20 enable = mkEnableOption "0bin";
24 default = "/var/lib/zerobin";
26 Path to the 0bin data directory
34 The user 0bin should run as
42 The group 0bin should run as
46 listenPort = mkOption {
51 The port zerobin should listen on
55 listenAddress = mkOption {
57 default = "localhost";
58 example = "127.0.0.1";
60 The address zerobin should listen to
64 extraConfig = mkOption {
71 COMPRESSED_STATIC_FILE = True
74 Extra configuration to be appended to the 0bin config file
75 (see https://0bin.readthedocs.org/en/latest/en/options.html)
81 config = mkIf (cfg.enable) {
82 users.users.${cfg.user} = optionalAttrs (cfg.user == "zerobin") {
88 users.groups.${cfg.group} = { };
90 systemd.services.zerobin = {
92 after = [ "network.target" ];
93 wantedBy = [ "multi-user.target" ];
94 serviceConfig.ExecStart = "${pkgs.zerobin}/bin/zerobin ${cfg.listenAddress} ${toString cfg.listenPort} false ${cfg.user} ${cfg.group} ${zerobin_config}";
95 serviceConfig.PrivateTmp = "yes";
96 serviceConfig.User = cfg.user;
97 serviceConfig.Group = cfg.group;
99 mkdir -p ${cfg.dataDir}
100 chown ${cfg.user} ${cfg.dataDir}