Personal-use NixOS configuration
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

A different approach

encode42 b0dc5bd2 d393018a

+9 -20
+9 -20
hosts/prospect/users/guest.nix
··· 7 7 }: 8 8 9 9 let 10 - persistentDirectories = [ 10 + persistentPaths = [ 11 11 ".manpath" 12 12 ".nix-defexpr" 13 13 ".nix-profile" 14 14 15 - ".steam" 16 15 ".local/share/Steam/package" 17 16 ".local/share/Steam/steamapps/common" 18 - ]; 19 - 20 - persistentFiles = [ 21 17 ".local/share/Steam/steamapps/libraryfolders.vdf" 22 18 ]; 23 19 24 - findDirectoryExclusions = builtins.concatStringsSep " \\\n" (map (path: 25 - let 26 - baseExclusion = "-not -path './${config.users.users.guest.home}/${path}"; 27 - in 28 - "${baseExclusion}' ${baseExclusion}/*'" 29 - ) persistentDirectories); 30 - 31 - findFileExclusions = builtins.concatStringsSep " \\\n" (map (path: 32 - "-not -path './${config.users.users.guest.home}/${path}'" 33 - ) persistentDirectories); 20 + rsyncExcludes = builtins.concatStringsSep " \\\n" (map (path: "--exclude='${path}'") persistentPaths); 34 21 in 35 22 { 36 23 imports = [ ··· 62 49 home.stateVersion = "25.05"; 63 50 }; 64 51 52 + environment.systemPackages = with pkgs; [ 53 + rsync 54 + ]; 55 + 65 56 systemd.services.clean-guest-home = { 66 57 description = "Perform guest account cleanup"; 67 58 wantedBy = [ "halt.target" "reboot.target" ]; ··· 71 62 Type = "oneshot"; 72 63 73 64 ExecStart = pkgs.writeShellScript "clean-guest-home" '' 74 - find ${config.users.users.guest.home} \ 75 - -mindepth 1 \ 76 - ${findDirectoryExclusions} \ 77 - ${findFileExclusions} \ 78 - -exec echo {} + 65 + rsync -a --delete \ 66 + ${rsyncExcludes} \ 67 + /var/empty ${config.users.users.guest.home} 79 68 ''; 80 69 }; 81 70 };