diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index b91b95583d8..6a06d6c23b7 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -366,6 +366,7 @@ ./services/games/minecraft-server.nix ./services/games/minetest-server.nix ./services/games/openarena.nix + ./services/games/quake3-server.nix ./services/games/teeworlds.nix ./services/games/terraria.nix ./services/hardware/acpid.nix diff --git a/nixos/modules/services/games/quake3-server.nix b/nixos/modules/services/games/quake3-server.nix new file mode 100644 index 00000000000..1dc01260e8f --- /dev/null +++ b/nixos/modules/services/games/quake3-server.nix @@ -0,0 +1,111 @@ +{ config, pkgs, lib, ... }: +with lib; + +let + cfg = config.services.quake3-server; + configFile = pkgs.writeText "q3ds-extra.cfg" '' + set net_port ${builtins.toString cfg.port} + + ${cfg.extraConfig} + ''; + defaultBaseq3 = pkgs.requireFile rec { + name = "baseq3"; + hashMode = "recursive"; + sha256 = "5dd8ee09eabd45e80450f31d7a8b69b846f59738726929298d8a813ce5725ed3"; + message = '' + Unfortunately, we cannot download ${name} automatically. + Please purchase a legitimate copy of Quake 3 and change into the installation directory. + + You can either add all relevant files to the nix-store like this: + mkdir /tmp/baseq3 + cp baseq3/pak*.pk3 /tmp/baseq3 + nix-store --add-fixed sha256 --recursive /tmp/baseq3 + + Alternatively you can set services.quake3-server.baseq3 to a path and copy the baseq3 directory into + $services.quake3-server.baseq3/.q3a/ + ''; + }; + home = pkgs.runCommand "quake3-home" {} '' + mkdir -p $out/.q3a/baseq3 + + for file in ${cfg.baseq3}/*; do + ln -s $file $out/.q3a/baseq3/$(basename $file) + done + + ln -s ${configFile} $out/.q3a/baseq3/nix.cfg + ''; +in { + options = { + services.quake3-server = { + enable = mkEnableOption "Quake 3 dedicated server"; + + port = mkOption { + type = types.port; + default = 27960; + description = '' + UDP Port the server should listen on. + ''; + }; + + openFirewall = mkOption { + type = types.bool; + default = false; + description = '' + Open the firewall. + ''; + }; + + extraConfig = mkOption { + type = types.lines; + default = ""; + example = '' + seta rconPassword "superSecret" // sets RCON password for remote console + seta sv_hostname "My Quake 3 server" // name that appears in server list + ''; + description = '' + Extra configuration options. Note that options changed via RCON will not be persisted. To list all possible + options, use "cvarlist 1" via RCON. + ''; + }; + + baseq3 = mkOption { + type = types.either types.package types.path; + default = defaultBaseq3; + example = "/var/lib/q3ds"; + description = '' + Path to the baseq3 files (pak*.pk3). If this is on the nix store (type = package) all .pk3 files should be saved + in the top-level directory. If this is on another filesystem (e.g /var/lib/baseq3) the .pk3 files are searched in + $baseq3/.q3a/baseq3/ + ''; + }; + }; + }; + + config = let + baseq3InStore = builtins.typeOf cfg.baseq3 == "set"; + in mkIf cfg.enable { + networking.firewall.allowedUDPPorts = mkIf cfg.openFirewall [ cfg.port ]; + + systemd.services.q3ds = { + description = "Quake 3 dedicated server"; + wantedBy = [ "multi-user.target" ]; + after = [ "networking.target" ]; + + environment.HOME = if baseq3InStore then home else cfg.baseq3; + + serviceConfig = with lib; { + Restart = "always"; + DynamicUser = true; + WorkingDirectory = home; + + # It is possible to alter configuration files via RCON. To ensure reproducibility we have to prevent this + ReadOnlyPaths = if baseq3InStore then home else cfg.baseq3; + ExecStartPre = optionalString (!baseq3InStore) "+${pkgs.coreutils}/bin/cp ${configFile} ${cfg.baseq3}/.q3a/baseq3/nix.cfg"; + + ExecStart = "${pkgs.ioquake3}/ioq3ded.x86_64 +exec nix.cfg"; + }; + }; + }; + + meta.maintainers = with maintainers; [ f4814n ]; +} diff --git a/nixos/modules/services/misc/home-assistant.nix b/nixos/modules/services/misc/home-assistant.nix index 2787c975b35..0590f54ae60 100644 --- a/nixos/modules/services/misc/home-assistant.nix +++ b/nixos/modules/services/misc/home-assistant.nix @@ -50,15 +50,10 @@ let # List of components used in config extraComponents = filter useComponent availableComponents; - testedPackage = if (cfg.autoExtraComponents && cfg.config != null) + package = if (cfg.autoExtraComponents && cfg.config != null) then (cfg.package.override { inherit extraComponents; }) else cfg.package; - # overridePythonAttrs has to be applied after override - package = testedPackage.overridePythonAttrs (oldAttrs: { - doCheck = false; - }); - # If you are changing this, please update the description in applyDefaultConfig defaultConfig = { homeassistant.time_zone = config.time.timeZone; @@ -188,9 +183,13 @@ in { }; package = mkOption { - default = pkgs.home-assistant; + default = pkgs.home-assistant.overrideAttrs (oldAttrs: { + doInstallCheck = false; + }); defaultText = literalExample '' - pkgs.home-assistant + pkgs.home-assistant.overrideAttrs (oldAttrs: { + doInstallCheck = false; + }) ''; type = types.package; example = literalExample '' @@ -199,12 +198,11 @@ in { } ''; description = '' - Home Assistant package to use. Tests are automatically disabled, as they take a considerable amout of time to complete. + Home Assistant package to use. By default the tests are disabled, as they take a considerable amout of time to complete. Override extraPackages or extraComponents in order to add additional dependencies. If you specify and do not set to false, overriding extraComponents will have no effect. - Avoid home-assistant.overridePythonAttrs if you use - autoExtraComponents. + Avoid home-assistant.overridePythonAttrs if you use autoExtraComponents. ''; }; diff --git a/pkgs/applications/misc/with-shell/default.nix b/pkgs/applications/misc/with-shell/default.nix index daf697c1661..cf52d194f61 100644 --- a/pkgs/applications/misc/with-shell/default.nix +++ b/pkgs/applications/misc/with-shell/default.nix @@ -1,20 +1,76 @@ -{ lib, stdenv, fetchFromGitHub }: -stdenv.mkDerivation { - name = "with-2016-08-20"; +{ lib +, stdenv +, fetchFromGitHub +, installShellFiles +}: + +stdenv.mkDerivation rec { + pname = "with"; + version = "unstable-2018-03-20"; + src = fetchFromGitHub { owner = "mchav"; repo = "With"; - rev = "cc2828bddd92297147d4365765f4ef36385f050a"; - sha256 = "10m2xv6icrdp6lfprw3a9hsrzb3bip19ipkbmscap0niddqgcl9b"; + rev = "28eb40bbc08d171daabf0210f420477ad75e16d6"; + hash = "sha256-mKHsLHs9/I+NUdb1t9wZWkPxXcsBlVWSj8fgZckXFXk="; }; + + nativeBuildInputs = [ installShellFiles ]; + installPhase = '' - mkdir -p $out/bin - cp with $out/bin/with + runHook preInstall + install -D with $out/bin/with + installShellCompletion --bash --name with.bash with.bash-completion + runHook postInstall ''; - meta = { + + meta = with lib; { homepage = "https://github.com/mchav/With"; description = "Command prefixing for continuous workflow using a single tool"; - license = lib.licenses.asl20; - platforms = lib.platforms.unix; + longDescription = '' + with is a Bash script that starts an interactive shell with where every + command is prefixed using . + + For example: + + $ with git + git> add . + git> commit -a -m "Commited" + git> push + + Can also be used for compound commands. + + $ with java Primes + java Primes> 1 + 2 + java Primes> 4 + 7 + + And to repeat commands: + + $ with gcc -o output input.c + gcc -o -output input.c> + + Compiling... + gcc -o -output input.c> + + To execute a shell command proper prefix line with :. + + git> :ls + + You can also drop, add, and replace different commands. + + git> +add + git add> + git add> !commit + git commit> + git commit> - + git> + + To exit use either :q or :exit. + ''; + license = licenses.asl20; + maintainers = with maintainers; [ AndersonTorres ]; + platforms = platforms.unix; }; } diff --git a/pkgs/applications/virtualization/podman/default.nix b/pkgs/applications/virtualization/podman/default.nix index b64fc82f532..956baea8856 100644 --- a/pkgs/applications/virtualization/podman/default.nix +++ b/pkgs/applications/virtualization/podman/default.nix @@ -16,13 +16,13 @@ buildGoModule rec { pname = "podman"; - version = "3.1.0"; + version = "3.1.1"; src = fetchFromGitHub { owner = "containers"; repo = "podman"; rev = "v${version}"; - sha256 = "sha256-Cql9ikk0lo/LeWNykEJSKgfGnBSUU5vOh/zUIEvMapk="; + sha256 = "1ihpz50c50frw9nrjp0vna2lg50kwlar6y6vr4s5sjiwza1qv2d2"; }; patches = [