@@ -106,6 +106,49 @@ in {
106106 '' ;
107107 } ;
108108
109+ adminList = lib . mkOption {
110+ type = with lib . types ; listOf str ;
111+ default = [ ] ;
112+ example = [
113+ "72057602627862526"
114+ "72057602627862527"
115+ ] ;
116+ description = lib . mdDoc ''
117+ List of Steam IDs to be added to the adminlist.txt file.
118+
119+ These users will have admin privileges on the server.
120+ '' ;
121+ } ;
122+
123+ permittedList = lib . mkOption {
124+ type = with lib . types ; listOf str ;
125+ default = [ ] ;
126+ example = [
127+ "72057602627862526"
128+ "72057602627862527"
129+ ] ;
130+ description = lib . mdDoc ''
131+ List of Steam IDs to be added to the permittedlist.txt file.
132+
133+ Only these users will be allowed to join the server if the list is not empty.
134+ If you use this, all players not on the list will be unable to join.
135+ '' ;
136+ } ;
137+
138+ bannedList = lib . mkOption {
139+ type = with lib . types ; listOf str ;
140+ default = [ ] ;
141+ example = [
142+ "72057602627862526"
143+ "72057602627862527"
144+ ] ;
145+ description = lib . mdDoc ''
146+ List of Steam IDs to be added to the bannedlist.txt file.
147+
148+ These users will be banned from the server.
149+ '' ;
150+ } ;
151+
109152 bepinexMods = lib . mkOption {
110153 type = with lib ; types . listOf types . package ;
111154 default = [ ] ;
@@ -181,8 +224,19 @@ in {
181224 cp $cfg $out/$(stripHash $cfg)
182225 done
183226 '' ;
227+ createListFile = name : list : ''
228+ echo "// List of Steam IDs for ${ name } ONE per line
229+ ${ lib . strings . concatStringsSep "\n " list } " > ${ stateDir } /.config/unity3d/IronGate/Valheim/${ name }
230+ chown valheim:valheim ${ stateDir } /.config/unity3d/IronGate/Valheim/${ name }
231+ '' ;
184232 in
185- lib . optionalString ( cfg . bepinexMods != [ ] ) ''
233+ ''
234+ mkdir -p ${ stateDir } /.config/unity3d/IronGate/Valheim
235+ ${ createListFile "adminlist.txt" cfg . adminList }
236+ ${ createListFile "permittedlist.txt" cfg . permittedList }
237+ ${ createListFile "bannedlist.txt" cfg . bannedList }
238+ ''
239+ + lib . optionalString ( cfg . bepinexMods != [ ] ) ''
186240 if [ -e ${ installDir } ]; then
187241 chmod -R +w ${ installDir }
188242 rm -rf ${ installDir }
0 commit comments