2 description = "Command line pastebin for sharing terminal output";
5 nixosModule = { config, lib, pkgs, ... }: {
6 options.services.fiche = {
7 enable = lib.mkEnableOption "Enable fiche’s service";
10 description = "Port to listen to";
12 domain = lib.mkOption {
14 description = "Domain";
16 dataDir = lib.mkOption {
17 type = lib.types.path;
18 default = "/var/lib/fiche";
19 description = "Directory where to place the pastes";
21 https = lib.mkEnableOption "Use https";
25 let cfg = config.services.fiche;
26 in lib.mkIf cfg.enable {
27 networking.firewall.allowedTCPPorts = [ cfg.port ];
29 systemd.services.fiche = {
30 description = "Fiche server";
31 wantedBy = [ "multi-user.target" ];
32 after = [ "network.target" ];
35 exec ${pkgs.fiche}/bin/fiche -o ${cfg.dataDir} -d ${cfg.domain} ${lib.optionalString cfg.https "-S "} -p ${builtins.toString cfg.port}
40 "+${pkgs.coreutils}/bin/install -m 0755 -o fiche -d ${cfg.dataDir}"
46 WorkingDirectory = cfg.dataDir;
47 ReadWritePaths = cfg.dataDir;