feat(minecraft): make username configurable
This commit is contained in:
parent
d9dba8b68a
commit
bfb06ba476
|
@ -4,7 +4,7 @@
|
||||||
, ... }: with lib; let
|
, ... }: with lib; let
|
||||||
inherit (config.passthrough) gui;
|
inherit (config.passthrough) gui;
|
||||||
cfg = config.passthrough.minecraft;
|
cfg = config.passthrough.minecraft;
|
||||||
enable = cfg.enable && config.home.username == "minecraft";
|
enable = cfg.enable && config.home.username == cfg.user;
|
||||||
in mkIf enable {
|
in mkIf enable {
|
||||||
home.packages = with pkgs; [
|
home.packages = with pkgs; [
|
||||||
jdk8
|
jdk8
|
||||||
|
|
|
@ -7,6 +7,11 @@
|
||||||
in {
|
in {
|
||||||
options.home.minecraft = {
|
options.home.minecraft = {
|
||||||
enable = mkEnableOption "minecraft game launcher and jvm";
|
enable = mkEnableOption "minecraft game launcher and jvm";
|
||||||
|
user = mkOption {
|
||||||
|
type = with types; str;
|
||||||
|
default = "minecraft";
|
||||||
|
description = "username which minecraft game client runs under";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
|
@ -15,14 +20,14 @@ in {
|
||||||
{ passthrough.minecraft = cfg; }
|
{ passthrough.minecraft = cfg; }
|
||||||
];
|
];
|
||||||
|
|
||||||
users.profiles.minecraft = mkIf cfg.enable {
|
users.profiles.minecraft = mkIf (cfg.enable && cfg.user == "minecraft") {
|
||||||
uid = 5801;
|
uid = 5801;
|
||||||
description = "Minecraft";
|
description = "Minecraft";
|
||||||
picture = ../picture/aux.png;
|
picture = ../picture/aux.png;
|
||||||
};
|
};
|
||||||
|
|
||||||
environment.persistence."/nix/persist".users.minecraft.directories = mkIf (cfg.enable && gui) [
|
environment.persistence."/nix/persist".users.${cfg.user} = mkIf (cfg.enable && gui) {
|
||||||
".local/share/PrismLauncher"
|
directories = [ ".local/share/PrismLauncher" ];
|
||||||
];
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue