Merge pull request #109414 from rgrunbla/galene

galene: init at 0.2

authored by Sandro and committed by GitHub e9876afb c13dc4a5

+211
+1
nixos/modules/module-list.nix
··· 876 ./services/web-apps/documize.nix 877 ./services/web-apps/dokuwiki.nix 878 ./services/web-apps/engelsystem.nix 879 ./services/web-apps/gerrit.nix 880 ./services/web-apps/gotify-server.nix 881 ./services/web-apps/grocy.nix
··· 876 ./services/web-apps/documize.nix 877 ./services/web-apps/dokuwiki.nix 878 ./services/web-apps/engelsystem.nix 879 + ./services/web-apps/galene.nix 880 ./services/web-apps/gerrit.nix 881 ./services/web-apps/gotify-server.nix 882 ./services/web-apps/grocy.nix
+178
nixos/modules/services/web-apps/galene.nix
···
··· 1 + { config, lib, pkgs, ... }: 2 + 3 + with lib; 4 + let 5 + cfg = config.services.galene; 6 + defaultstateDir = "/var/lib/galene"; 7 + defaultrecordingsDir = "${cfg.stateDir}/recordings"; 8 + defaultgroupsDir = "${cfg.stateDir}/groups"; 9 + defaultdataDir = "${cfg.stateDir}/data"; 10 + in 11 + { 12 + options = { 13 + services.galene = { 14 + enable = mkEnableOption "Galene Service."; 15 + 16 + stateDir = mkOption { 17 + default = defaultstateDir; 18 + type = types.str; 19 + description = '' 20 + The directory where Galene stores its internal state. If left as the default 21 + value this directory will automatically be created before the Galene server 22 + starts, otherwise the sysadmin is responsible for ensuring the directory 23 + exists with appropriate ownership and permissions. 24 + ''; 25 + }; 26 + 27 + user = mkOption { 28 + type = types.str; 29 + default = "galene"; 30 + description = "User account under which galene runs."; 31 + }; 32 + 33 + group = mkOption { 34 + type = types.str; 35 + default = "galene"; 36 + description = "Group under which galene runs."; 37 + }; 38 + 39 + insecure = mkOption { 40 + type = types.bool; 41 + default = false; 42 + description = '' 43 + Whether Galene should listen in http or in https. If left as the default 44 + value (false), Galene needs to be fed a private key and a certificate. 45 + ''; 46 + }; 47 + 48 + certFile = mkOption { 49 + type = types.nullOr types.str; 50 + default = null; 51 + example = "/path/to/your/cert.pem"; 52 + description = '' 53 + Path to the server's certificate. The file is copied at runtime to 54 + Galene's data directory where it needs to reside. 55 + ''; 56 + }; 57 + 58 + keyFile = mkOption { 59 + type = types.nullOr types.str; 60 + default = null; 61 + example = "/path/to/your/key.pem"; 62 + description = '' 63 + Path to the server's private key. The file is copied at runtime to 64 + Galene's data directory where it needs to reside. 65 + ''; 66 + }; 67 + 68 + httpAddress = mkOption { 69 + type = types.str; 70 + default = ""; 71 + description = "HTTP listen address for galene."; 72 + }; 73 + 74 + httpPort = mkOption { 75 + type = types.port; 76 + default = 8443; 77 + description = "HTTP listen port."; 78 + }; 79 + 80 + staticDir = mkOption { 81 + type = types.str; 82 + default = "${cfg.package.static}/static"; 83 + example = "/var/lib/galene/static"; 84 + description = "Web server directory."; 85 + }; 86 + 87 + recordingsDir = mkOption { 88 + type = types.str; 89 + default = defaultrecordingsDir; 90 + example = "/var/lib/galene/recordings"; 91 + description = "Recordings directory."; 92 + }; 93 + 94 + dataDir = mkOption { 95 + type = types.str; 96 + default = defaultdataDir; 97 + example = "/var/lib/galene/data"; 98 + description = "Data directory."; 99 + }; 100 + 101 + groupsDir = mkOption { 102 + type = types.str; 103 + default = defaultgroupsDir; 104 + example = "/var/lib/galene/groups"; 105 + description = "Web server directory."; 106 + }; 107 + 108 + package = mkOption { 109 + default = pkgs.galene; 110 + defaultText = "pkgs.galene"; 111 + type = types.package; 112 + description = '' 113 + Package for running Galene. 114 + ''; 115 + }; 116 + }; 117 + }; 118 + 119 + config = mkIf cfg.enable { 120 + assertions = [ 121 + { 122 + assertion = cfg.insecure || (cfg.certFile != null && cfg.keyFile != null); 123 + message = '' 124 + Galene needs both certFile and keyFile defined for encryption, or 125 + the insecure flag. 126 + ''; 127 + } 128 + ]; 129 + 130 + systemd.services.galene = { 131 + description = "galene"; 132 + after = [ "network.target" ]; 133 + wantedBy = [ "multi-user.target" ]; 134 + 135 + preStart = '' 136 + install -m 700 -o '${cfg.user}' -g '${cfg.group}' ${cfg.certFile} ${cfg.dataDir}/cert.pem 137 + install -m 700 -o '${cfg.user}' -g '${cfg.group}' ${cfg.keyFile} ${cfg.dataDir}/key.pem 138 + ''; 139 + 140 + serviceConfig = mkMerge [ 141 + { 142 + Type = "simple"; 143 + User = cfg.user; 144 + Group = cfg.group; 145 + WorkingDirectory = cfg.stateDir; 146 + ExecStart = ''${cfg.package}/bin/galene \ 147 + ${optionalString (cfg.insecure) "-insecure"} \ 148 + -data ${cfg.dataDir} \ 149 + -groups ${cfg.groupsDir} \ 150 + -recordings ${cfg.recordingsDir} \ 151 + -static ${cfg.staticDir}''; 152 + Restart = "always"; 153 + # Upstream Requirements 154 + LimitNOFILE = 65536; 155 + StateDirectory = [ ] ++ 156 + optional (cfg.stateDir == defaultstateDir) "galene" ++ 157 + optional (cfg.dataDir == defaultdataDir) "galene/data" ++ 158 + optional (cfg.groupsDir == defaultgroupsDir) "galene/groups" ++ 159 + optional (cfg.recordingsDir == defaultrecordingsDir) "galene/recordings"; 160 + } 161 + ]; 162 + }; 163 + 164 + users.users = mkIf (cfg.user == "galene") 165 + { 166 + galene = { 167 + description = "galene Service"; 168 + group = cfg.group; 169 + isSystemUser = true; 170 + }; 171 + }; 172 + 173 + users.groups = mkIf (cfg.group == "galene") { 174 + galene = { }; 175 + }; 176 + }; 177 + meta.maintainers = with lib.maintainers; [ rgrunbla ]; 178 + }
+30
pkgs/servers/web-apps/galene/default.nix
···
··· 1 + { stdenv, fetchFromGitHub, buildGoModule }: 2 + 3 + buildGoModule rec { 4 + pname = "galene"; 5 + version = "0.2"; 6 + 7 + src = fetchFromGitHub { 8 + owner = "jech"; 9 + repo = "galene"; 10 + rev = "galene-${version}"; 11 + sha256 = "0hpgqqv8mp1d3sk7dk49m3yv0cv4afa0v3vdd4w8mdnx6pcqdgy1"; 12 + }; 13 + 14 + vendorSha256 = "12b7andpzsgzmd56gg4gc5ilkxvjrpwpmwbdmygfzgkd5jncmcgp"; 15 + 16 + outputs = [ "out" "static" ]; 17 + 18 + postInstall = '' 19 + mkdir $static 20 + cp -r ./static $static 21 + ''; 22 + 23 + meta = with stdenv.lib; { 24 + description = "Videoconferencing server that is easy to deploy, written in Go"; 25 + homepage = "https://github.com/jech/galene"; 26 + license = licenses.mit; 27 + platforms = platforms.linux; 28 + maintainers = with maintainers; [ rgrunbla ]; 29 + }; 30 + }
+2
pkgs/top-level/all-packages.nix
··· 1271 1272 gaia = callPackage ../development/libraries/gaia { }; 1273 1274 gamecube-tools = callPackage ../development/tools/gamecube-tools { }; 1275 1276 gammy = qt5.callPackage ../tools/misc/gammy { };
··· 1271 1272 gaia = callPackage ../development/libraries/gaia { }; 1273 1274 + galene = callPackage ../servers/web-apps/galene {}; 1275 + 1276 gamecube-tools = callPackage ../development/tools/gamecube-tools { }; 1277 1278 gammy = qt5.callPackage ../tools/misc/gammy { };