fix(minecraft): run minecraft under dedicated user
This commit is contained in:
parent
0cd51bf325
commit
d6ccbde72f
|
@ -3,7 +3,7 @@
|
||||||
, config
|
, config
|
||||||
, ... }: with lib; let
|
, ... }: with lib; let
|
||||||
cfg = config.passthrough.minecraft;
|
cfg = config.passthrough.minecraft;
|
||||||
enable = cfg.enable && (cfg.allUsers || (config.home.username == "app"));
|
enable = cfg.enable && config.home.username == "minecraft";
|
||||||
in mkIf enable {
|
in mkIf enable {
|
||||||
home.packages = with pkgs; [
|
home.packages = with pkgs; [
|
||||||
prismlauncher
|
prismlauncher
|
||||||
|
|
|
@ -3,11 +3,10 @@
|
||||||
, config
|
, config
|
||||||
, ... }: with lib; let
|
, ... }: with lib; let
|
||||||
cfg = config.home.minecraft;
|
cfg = config.home.minecraft;
|
||||||
persist = [ ".local/share/PrismLauncher" ];
|
gui = with config.global.gpu; enable && session;
|
||||||
in {
|
in {
|
||||||
options.home.minecraft = {
|
options.home.minecraft = {
|
||||||
enable = mkEnableOption "minecraft game launcher and jvm";
|
enable = mkEnableOption "minecraft game launcher and jvm";
|
||||||
allUsers = mkEnableOption "set up for all users";
|
|
||||||
};
|
};
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
|
@ -16,7 +15,14 @@ in {
|
||||||
{ passthrough.minecraft = cfg; }
|
{ passthrough.minecraft = cfg; }
|
||||||
];
|
];
|
||||||
|
|
||||||
users.home.persist.directories = with cfg; mkIf (enable && allUsers) persist;
|
users.profiles.minecraft = mkIf cfg.enable {
|
||||||
users.home.persistApp.directories = with cfg; mkIf (enable && !allUsers) persist;
|
uid = 5801;
|
||||||
|
description = "Minecraft";
|
||||||
|
picture = ../picture/aux.png;
|
||||||
|
};
|
||||||
|
|
||||||
|
environment.persistence."/nix/persist".users.minecraft.directories = mkIf (cfg.enable && gui) [
|
||||||
|
".local/share/PrismLauncher"
|
||||||
|
];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue