]> Git — Sourcephile - julm/julm-nix.git/blob - home-manager/profiles/nix.nix
networkmanager: guard fix behind enable flag
[julm/julm-nix.git] / home-manager / profiles / nix.nix
1 { pkgs, lib, config, nixosConfig, ... }:
2 {
3 programs.home-manager.enable = true;
4 home.packages = [
5 pkgs.home-manager
6 pkgs.nix-du
7 ] ++ pkgs.lib.optionals pkgs.stdenv.hostPlatform.isx86_64 [
8 pkgs.nix-tree
9 ];
10 # Keep only the last generation of the home-manager profile
11 home.activation.delete-generations = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
12 if [ "$(${pkgs.coreutils}/bin/id -u)" = 0 ]
13 then profile="''${NIX_STATE_DIR:-/nix/var/nix}/profiles/per-user/$USER"
14 else profile="''${XDG_STATE_HOME:-$HOME/.local/state}"/nix/profiles
15 fi
16 ${pkgs.nix}/bin/nix-env --delete-generations +1 --profile "$profile"/home-manager
17 '';
18 }