[NixOS] Programatically get the list of users

This commit is contained in:
Ivan Malison 2023-12-30 22:42:43 -07:00
parent 0f65575a35
commit a75824ee2a

View File

@ -1,7 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
users=("root" "imalison" "kat" "dean" "alex" "will" "mike") for user in $(awk -F':' '{ if ($3 >= 1000 && $7 !~ /nologin|false|sync|shutdown|halt/) print $1 }' /etc/passwd); do
echo $user
for user in "${users[@]}"; do sudo su - $user -c 'home-manager expire-generations -1days'
sudo su - $user -c 'home-manager expire-generations -15days'
done done