quakeflake/flake.nix

52 lines
1.5 KiB
Nix
Raw Normal View History

2021-12-02 01:59:44 +01:00
{
description = "Quake 3 Arena Dedicated Server";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/release-21.11";
};
outputs = inputs@{ self, nixpkgs }: {
packages = builtins.mapAttrs (system: _:
let
inherit (self.nixosConfigurations) quakeserver;
remoteCommand = "ssh -Co ClearAllForwardings=yes sbz -- sudo lxc-attach -n quake-astro --";
in rec {
rootfs = quakeserver.config.system.build.toplevel;
container = quakeserver.config.system.build.tarball;
deploy = with nixpkgs.legacyPackages.${system};
writeScriptBin "deploy" ''
#! ${runtimeShell} -e
nix-store --export $(cat ${writeReferencesToFile rootfs}) | pv -brep | ${remoteCommand} /run/current-system/sw/bin/nix-store --import
${remoteCommand} ${rootfs}/bin/switch-to-configuration switch
'';
} //
import ./pkgs/baseq3.nix (inputs // { inherit system; })
) { x86_64-linux = true; };
nixosModules = {
container = import ./nixos-modules/container.nix;
quake3ded = import ./nixos-modules/quake3ded.nix;
};
nixosConfigurations.quakeserver = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
extraArgs = {
inherit self;
};
modules = [
"${nixpkgs}/nixos/modules/virtualisation/lxc-container.nix"
self.nixosModules.container
self.nixosModules.quake3ded
{
networking.hostName = "quakeserver";
}
];
};
};
}