···11+{ config, pkgs, lib, ... }:
22+with lib;
33+44+let
55+ cfg = config.services.quake3-server;
66+ configFile = pkgs.writeText "q3ds-extra.cfg" ''
77+ set net_port ${builtins.toString cfg.port}
88+99+ ${cfg.extraConfig}
1010+ '';
1111+ defaultBaseq3 = pkgs.requireFile rec {
1212+ name = "baseq3";
1313+ hashMode = "recursive";
1414+ sha256 = "5dd8ee09eabd45e80450f31d7a8b69b846f59738726929298d8a813ce5725ed3";
1515+ message = ''
1616+ Unfortunately, we cannot download ${name} automatically.
1717+ Please purchase a legitimate copy of Quake 3 and change into the installation directory.
1818+1919+ You can either add all relevant files to the nix-store like this:
2020+ mkdir /tmp/baseq3
2121+ cp baseq3/pak*.pk3 /tmp/baseq3
2222+ nix-store --add-fixed sha256 --recursive /tmp/baseq3
2323+2424+ Alternatively you can set services.quake3-server.baseq3 to a path and copy the baseq3 directory into
2525+ $services.quake3-server.baseq3/.q3a/
2626+ '';
2727+ };
2828+ home = pkgs.runCommand "quake3-home" {} ''
2929+ mkdir -p $out/.q3a/baseq3
3030+3131+ for file in ${cfg.baseq3}/*; do
3232+ ln -s $file $out/.q3a/baseq3/$(basename $file)
3333+ done
3434+3535+ ln -s ${configFile} $out/.q3a/baseq3/nix.cfg
3636+ '';
3737+in {
3838+ options = {
3939+ services.quake3-server = {
4040+ enable = mkEnableOption "Quake 3 dedicated server";
4141+4242+ port = mkOption {
4343+ type = types.port;
4444+ default = 27960;
4545+ description = ''
4646+ UDP Port the server should listen on.
4747+ '';
4848+ };
4949+5050+ openFirewall = mkOption {
5151+ type = types.bool;
5252+ default = false;
5353+ description = ''
5454+ Open the firewall.
5555+ '';
5656+ };
5757+5858+ extraConfig = mkOption {
5959+ type = types.lines;
6060+ default = "";
6161+ example = ''
6262+ seta rconPassword "superSecret" // sets RCON password for remote console
6363+ seta sv_hostname "My Quake 3 server" // name that appears in server list
6464+ '';
6565+ description = ''
6666+ Extra configuration options. Note that options changed via RCON will not be persisted. To list all possible
6767+ options, use "cvarlist 1" via RCON.
6868+ '';
6969+ };
7070+7171+ baseq3 = mkOption {
7272+ type = types.either types.package types.path;
7373+ default = defaultBaseq3;
7474+ example = "/var/lib/q3ds";
7575+ description = ''
7676+ Path to the baseq3 files (pak*.pk3). If this is on the nix store (type = package) all .pk3 files should be saved
7777+ in the top-level directory. If this is on another filesystem (e.g /var/lib/baseq3) the .pk3 files are searched in
7878+ $baseq3/.q3a/baseq3/
7979+ '';
8080+ };
8181+ };
8282+ };
8383+8484+ config = let
8585+ baseq3InStore = builtins.typeOf cfg.baseq3 == "set";
8686+ in mkIf cfg.enable {
8787+ networking.firewall.allowedUDPPorts = mkIf cfg.openFirewall [ cfg.port ];
8888+8989+ systemd.services.q3ds = {
9090+ description = "Quake 3 dedicated server";
9191+ wantedBy = [ "multi-user.target" ];
9292+ after = [ "networking.target" ];
9393+9494+ environment.HOME = if baseq3InStore then home else cfg.baseq3;
9595+9696+ serviceConfig = with lib; {
9797+ Restart = "always";
9898+ DynamicUser = true;
9999+ WorkingDirectory = home;
100100+101101+ # It is possible to alter configuration files via RCON. To ensure reproducibility we have to prevent this
102102+ ReadOnlyPaths = if baseq3InStore then home else cfg.baseq3;
103103+ ExecStartPre = optionalString (!baseq3InStore) "+${pkgs.coreutils}/bin/cp ${configFile} ${cfg.baseq3}/.q3a/baseq3/nix.cfg";
104104+105105+ ExecStart = "${pkgs.ioquake3}/ioq3ded.x86_64 +exec nix.cfg";
106106+ };
107107+ };
108108+ };
109109+110110+ meta.maintainers = with maintainers; [ f4814n ];
111111+}
+9-11
nixos/modules/services/misc/home-assistant.nix
···5050 # List of components used in config
5151 extraComponents = filter useComponent availableComponents;
52525353- testedPackage = if (cfg.autoExtraComponents && cfg.config != null)
5353+ package = if (cfg.autoExtraComponents && cfg.config != null)
5454 then (cfg.package.override { inherit extraComponents; })
5555 else cfg.package;
5656-5757- # overridePythonAttrs has to be applied after override
5858- package = testedPackage.overridePythonAttrs (oldAttrs: {
5959- doCheck = false;
6060- });
61566257 # If you are changing this, please update the description in applyDefaultConfig
6358 defaultConfig = {
···188183 };
189184190185 package = mkOption {
191191- default = pkgs.home-assistant;
186186+ default = pkgs.home-assistant.overrideAttrs (oldAttrs: {
187187+ doInstallCheck = false;
188188+ });
192189 defaultText = literalExample ''
193193- pkgs.home-assistant
190190+ pkgs.home-assistant.overrideAttrs (oldAttrs: {
191191+ doInstallCheck = false;
192192+ })
194193 '';
195194 type = types.package;
196195 example = literalExample ''
···199198 }
200199 '';
201200 description = ''
202202- Home Assistant package to use. Tests are automatically disabled, as they take a considerable amout of time to complete.
201201+ Home Assistant package to use. By default the tests are disabled, as they take a considerable amout of time to complete.
203202 Override <literal>extraPackages</literal> or <literal>extraComponents</literal> in order to add additional dependencies.
204203 If you specify <option>config</option> and do not set <option>autoExtraComponents</option>
205204 to <literal>false</literal>, overriding <literal>extraComponents</literal> will have no effect.
206206- Avoid <literal>home-assistant.overridePythonAttrs</literal> if you use
207207- <literal>autoExtraComponents</literal>.
205205+ Avoid <literal>home-assistant.overridePythonAttrs</literal> if you use <literal>autoExtraComponents</literal>.
208206 '';
209207 };
210208
+66-10
pkgs/applications/misc/with-shell/default.nix
···11-{ lib, stdenv, fetchFromGitHub }:
22-stdenv.mkDerivation {
33- name = "with-2016-08-20";
11+{ lib
22+, stdenv
33+, fetchFromGitHub
44+, installShellFiles
55+}:
66+77+stdenv.mkDerivation rec {
88+ pname = "with";
99+ version = "unstable-2018-03-20";
1010+411 src = fetchFromGitHub {
512 owner = "mchav";
613 repo = "With";
77- rev = "cc2828bddd92297147d4365765f4ef36385f050a";
88- sha256 = "10m2xv6icrdp6lfprw3a9hsrzb3bip19ipkbmscap0niddqgcl9b";
1414+ rev = "28eb40bbc08d171daabf0210f420477ad75e16d6";
1515+ hash = "sha256-mKHsLHs9/I+NUdb1t9wZWkPxXcsBlVWSj8fgZckXFXk=";
916 };
1717+1818+ nativeBuildInputs = [ installShellFiles ];
1919+1020 installPhase = ''
1111- mkdir -p $out/bin
1212- cp with $out/bin/with
2121+ runHook preInstall
2222+ install -D with $out/bin/with
2323+ installShellCompletion --bash --name with.bash with.bash-completion
2424+ runHook postInstall
1325 '';
1414- meta = {
2626+2727+ meta = with lib; {
1528 homepage = "https://github.com/mchav/With";
1629 description = "Command prefixing for continuous workflow using a single tool";
1717- license = lib.licenses.asl20;
1818- platforms = lib.platforms.unix;
3030+ longDescription = ''
3131+ with is a Bash script that starts an interactive shell with where every
3232+ command is prefixed using <program>.
3333+3434+ For example:
3535+3636+ $ with git
3737+ git> add .
3838+ git> commit -a -m "Commited"
3939+ git> push
4040+4141+ Can also be used for compound commands.
4242+4343+ $ with java Primes
4444+ java Primes> 1
4545+ 2
4646+ java Primes> 4
4747+ 7
4848+4949+ And to repeat commands:
5050+5151+ $ with gcc -o output input.c
5252+ gcc -o -output input.c>
5353+ <enter>
5454+ Compiling...
5555+ gcc -o -output input.c>
5656+5757+ To execute a shell command proper prefix line with :.
5858+5959+ git> :ls
6060+6161+ You can also drop, add, and replace different commands.
6262+6363+ git> +add
6464+ git add> <some file>
6565+ git add> !commit
6666+ git commit> <arguments and message>
6767+ git commit> -
6868+ git>
6969+7070+ To exit use either :q or :exit.
7171+ '';
7272+ license = licenses.asl20;
7373+ maintainers = with maintainers; [ AndersonTorres ];
7474+ platforms = platforms.unix;
1975 };
2076}