Skip to content

Commit

Permalink
flake.nix: improve cleanup process in devShell
Browse files Browse the repository at this point in the history
  • Loading branch information
thiagokokada committed Oct 12, 2023
1 parent a504f53 commit c0a3693
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -204,11 +204,17 @@
# Ensure that nix/nix-build is in PATH
packages = [ pkgs.nix ] ++ packages;
shellHook = ''
cleanup() {
chmod +w -R ${homeDirectory}
rm -rf ${homeDirectory}
rmdir --ignore-fail-on-non-empty ${homePath}
}
trap "cleanup" EXIT
export HOME=${homeDirectory}
mkdir -p "$HOME"
trap "rm -rf ${homePath}" EXIT
${homeManager.activationPackage}/activate
if [[ -L ${profileDirectory}/etc/profile.d/hm-session-vars.sh ]]; then
Expand Down

0 comments on commit c0a3693

Please sign in to comment.