Reorganize repository

This commit is contained in:
Charlotte Van Petegem 2021-07-10 09:03:38 +02:00
parent da1824edb6
commit 0fc6c32a47
No known key found for this signature in database
GPG key ID: 019E764B7184435A
124 changed files with 16295 additions and 1229 deletions

26
modules/games/default.nix Normal file
View file

@ -0,0 +1,26 @@
{ config, lib, ... }:
{
imports = [
./minecraft
./mumble
./steam
./teeworlds
./tetris
./zeroad
];
options.chvp.games.enable = lib.mkOption {
default = false;
example = true;
};
config = lib.mkIf config.chvp.games.enable {
chvp.games = {
minecraft.client = lib.mkDefault true;
mumble.enable = lib.mkDefault true;
steam.enable = lib.mkDefault true;
zeroad.client = lib.mkDefault true;
};
};
}

View file

@ -0,0 +1,32 @@
{ config, lib, pkgs, ... }:
{
options.chvp.games.minecraft = {
client = lib.mkOption {
default = false;
example = true;
};
server = lib.mkOption {
default = false;
example = true;
};
};
config = lib.mkIf (config.chvp.games.minecraft.client || config.chvp.games.minecraft.server) {
home-manager.users.charlotte = lib.mkIf config.chvp.games.minecraft.client ({ ... }: {
home.packages = [ pkgs.minecraft ];
});
chvp.base = {
zfs.homeLinks = lib.optional config.chvp.games.minecraft.client { path = ".minecraft"; type = "cache"; };
nix.unfreePackages =
(lib.optional config.chvp.games.minecraft.client "minecraft-launcher") ++
(lib.optional config.chvp.games.minecraft.server "minecraft-server");
};
services.minecraft-server = lib.mkIf config.chvp.games.minecraft.server {
enable = true;
dataDir = "${config.chvp.dataPrefix}/var/lib/minecraft-server";
eula = true;
openFirewall = true;
};
};
}

View file

@ -0,0 +1,19 @@
{ config, lib, pkgs, ... }:
{
options.chvp.games.mumble.enable = lib.mkOption {
default = false;
example = true;
};
config = lib.mkIf config.chvp.games.mumble.enable {
chvp.base.zfs.homeLinks = [
{ path = ".config/Mumble"; type = "data"; }
{ path = ".local/share/Mumble"; type = "data"; }
];
home-manager.users.charlotte = { ... }: {
home.packages = with pkgs; [ mumble ];
};
};
}

View file

@ -0,0 +1,29 @@
{ config, lib, pkgs, ... }:
{
options.chvp.games.steam.enable = lib.mkOption {
default = false;
example = true;
};
config = lib.mkIf config.chvp.games.steam.enable {
hardware.opengl = {
driSupport32Bit = true;
extraPackages = with pkgs.pkgsi686Linux; [ libva ];
};
services.pipewire.alsa.support32Bit = true;
chvp.base = {
nix.unfreePackages = [ "steam" "steam-original" "steam-runtime" ];
zfs.homeLinks = [
{ path = ".paradoxlauncher"; type = "cache"; }
{ path = ".steam"; type = "cache"; }
{ path = ".local/share/Steam"; type = "cache"; }
{ path = ".local/share/Paradox Interactive"; type = "cache"; }
];
};
home-manager.users.charlotte = { pkgs, ... }: {
home.packages = [ pkgs.steam ];
};
};
}

View file

@ -0,0 +1,24 @@
{ config, lib, ... }:
{
options = {
chvp.games.teeworlds.server = lib.mkOption {
default = false;
example = true;
};
};
config = lib.mkIf config.chvp.games.teeworlds.server {
services.teeworlds = {
enable = true;
openPorts = true;
extraOptions = [
"sv_gametype ctf"
"sv_maprotation ctf1 ctf2 ctf3 ctf4 ctf5 ctf6 ctf7 ctf8"
"sv_map ctf1"
"sv_scorelimit 250"
"sv_teamdamage 1"
];
};
};
}

View file

@ -0,0 +1,39 @@
{ config, lib, pkgs, ... }:
let
tetris = pkgs.mkYarnPackage rec {
pname = "tetris";
version = "unstable";
src = pkgs.fetchFromGitHub {
owner = "chvp";
repo = "tetris";
rev = "a3ff63bb8aecd42241a40ac8f7bdb6acacef7038";
sha256 = "0nlj268kwbv45gsmsp2rc2bfdmbiks21pr8zsa22nfkpbm6m4c03";
};
packageJSON = ./package.json;
yarnLock = ./yarn.lock;
yarnNix = ./yarn.nix;
buildPhase = "yarn run build";
installPhase = ''
cp -r deps/tetris/dist $out
rm $out/*.map
'';
distPhase = "true";
};
in
{
options.chvp.games.tetris.server = lib.mkOption {
default = false;
example = true;
};
config = lib.mkIf config.chvp.games.tetris.server {
chvp.services.nginx.hosts = [{
fqdn = "tetris.vanpetegem.me";
options = {
root = "${tetris}";
locations."/".index = "index.html";
};
}];
};
}

View file

@ -0,0 +1,21 @@
{
"name": "tetris",
"version": "1.0.0",
"main": "src/index.ts",
"scripts": {
"dev": "parcel src/index.html",
"build": "parcel build src/index.html"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^4.4.0",
"@typescript-eslint/parser": "^4.4.0",
"eslint": "^7.11.0",
"eslint-config-standard": "^14.1.1",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-standard": "^4.0.1",
"parcel-bundler": "^1.12.4",
"typescript": "^4.0.3"
}
}

5
modules/games/tetris/update.sh Executable file
View file

@ -0,0 +1,5 @@
#!/usr/bin/env nix-shell
#!nix-shell -p curl yarn2nix -i bash
curl -L -O https://github.com/chvp/tetris/raw/master/package.json
curl -L -O https://github.com/chvp/tetris/raw/master/yarn.lock
yarn2nix --lockfile yarn.lock --no-patch > yarn.nix

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,37 @@
{ config, lib, pkgs, ... }:
{
options = {
chvp.games.zeroad = {
client = lib.mkOption {
default = false;
example = true;
};
server = lib.mkOption {
default = false;
example = true;
};
};
};
config = lib.mkIf (config.chvp.games.zeroad.server || config.chvp.games.zeroad.client) {
chvp.base.zfs.homeLinks = [
{ path = ".config/0ad"; type = "cache"; }
];
# Needs to be here, since a headless server probably doesn't have this enabled yet.
hardware.opengl.enable = true;
home-manager.users.charlotte = { pkgs, ... }: {
home.packages = [ pkgs.zeroad ];
};
networking.firewall = lib.mkIf config.chvp.games.zeroad.server {
allowedTCPPorts = [ 20595 ];
allowedUDPPorts = [ 20595 ];
};
services.xrdp = lib.mkIf config.chvp.games.zeroad.server {
enable = true;
defaultWindowManager = "${pkgs.icewm}/bin/icewm";
};
};
}