Minecraft

This commit is contained in:
Charlotte Van Petegem 2021-03-08 14:57:26 +01:00
parent 2060295da9
commit 3ac380fd61
No known key found for this signature in database
GPG key ID: 019E764B7184435A
10 changed files with 53 additions and 20 deletions

View file

@ -10,6 +10,7 @@
./git.nix
./global-mailer.nix
./gomuks.nix
./minecraft.nix
./neovim.nix
./nix.nix
./nginx.nix

30
modules/minecraft.nix Normal file
View file

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

View file

@ -47,9 +47,9 @@ in
default = true;
example = false;
};
enableUnfree = lib.mkOption {
default = false;
example = true;
unfreePackages = lib.mkOption {
default = [ ];
example = [ "teams" ];
};
# Note that this is only enabled for charlotte, until https://github.com/bennofs/nix-index/issues/143 is resolved.
enableNixIndex = lib.mkOption {
@ -84,14 +84,7 @@ in
'');
};
nixpkgs.config = lib.mkIf config.chvp.nix.enableUnfree {
allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
"citrix-workspace"
"dropbox"
"teams"
"google-chrome"
];
};
nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) config.chvp.nix.unfreePackages;
nixpkgs.overlays = lib.mkIf config.chvp.nix.enableFlakes [
(self: super: {
nix = super.nixUnstable;