aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rwxr-xr-xbin/gc21
-rwxr-xr-xbin/reconfigure6
-rwxr-xr-xbin/update9
3 files changed, 36 insertions, 0 deletions
diff --git a/bin/gc b/bin/gc
index 8622a7d..4634f8c 100755
--- a/bin/gc
+++ b/bin/gc
@@ -18,6 +18,7 @@ help() {
TYPE what to do GC on (default: all):
- guix
+ - nix
- trash
- tmpdir
- coredump
@@ -93,6 +94,25 @@ gc_guix() {
fi
}
+gc_nix() {
+ if [ ! -e /nix/ ]; then
+ return
+ fi
+
+ PROFILES='
+ /nix/var/nix/profiles/per-user/root/channels
+ /nix/var/nix/profiles/system
+ '
+
+ for p in $PROFILES; do
+ pass show "$(hostname)"/andreh | head -n1 |
+ sudo -iS nix-env --delete-generations old -p "$p"
+ done
+ nix-env --delete-generations old
+ nix-store --gc
+ nix-collect-garbage -d
+}
+
gc_trash() {
yes | trash-empty
}
@@ -122,6 +142,7 @@ gc_docker() {
TYPES='
guix
+nix
trash
tmpdir
docker
diff --git a/bin/reconfigure b/bin/reconfigure
index 2df3ee7..14a8629 100755
--- a/bin/reconfigure
+++ b/bin/reconfigure
@@ -21,6 +21,7 @@ help() {
Switches the system:
- reconfigure the Guix "home" environment;
- Guix "system" if it exists;
+ - NixOS if it exists.
Examples:
@@ -94,6 +95,11 @@ pass show "$(hostname)"/andreh |
head -n1 |
sudo -ES guix system -v3 reconfigure "$XDG_CONFIG_HOME"/guix/system.scm
+if [ -e /etc/nixos/configuration.nix ]; then
+ pass show "$HOSTNAME"/andreh |
+ head -n1 |
+ sudo -S nixos-rebuild switch
+fi
bins > /dev/null
diff --git a/bin/update b/bin/update
index dc8a84f..6e6effc 100755
--- a/bin/update
+++ b/bin/update
@@ -64,6 +64,15 @@ done
shift $((OPTIND - 1))
+HOSTNAME="$(hostname)"
+if [ -e /etc/nixos/configuration.nix ]; then
+ pass show "$HOSTNAME"/andreh |
+ head -n1 |
+ sudo -S nix-channel --update
+else
+ nix-channel --update
+fi
+
guix pull -v3
rfc -u