diff options
-rwxr-xr-x | bin/gc | 21 | ||||
-rwxr-xr-x | bin/reconfigure | 6 | ||||
-rwxr-xr-x | bin/update | 9 | ||||
-rw-r--r-- | etc/guix/system.scm | 1 | ||||
-rw-r--r-- | etc/sh/rc | 16 | ||||
-rwxr-xr-x | opt/aux/gen-e-list.sh | 1 |
6 files changed, 53 insertions, 1 deletions
@@ -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 @@ -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 diff --git a/etc/guix/system.scm b/etc/guix/system.scm index 9157a16..5fdd436 100644 --- a/etc/guix/system.scm +++ b/etc/guix/system.scm @@ -143,6 +143,7 @@ Seiko Epson Color Ink Jet Printers.") (append (map (compose list specification->package+output symbol->string) '(nss-certs + nix cups ghc ghc-xmonad-contrib @@ -297,6 +297,20 @@ guix_env() { printf ')' } +in_nix_shell() { + if [ -z "${IN_NIX_SHELL:-}" ]; then + return + fi + + printf '\n' + color -c blacki '~> ' + color -c purpleb "$IN_NIX_SHELL " + color -c purple 'nix-shell ' + printf '(' + color -c blueb "${name:-}" + printf ')' +} + in_ssh_session() { if [ -n "${SSH_CLIENT:-}" ]; then color -c blackb '\\u' @@ -323,7 +337,7 @@ vcs_status() { fi } -PS1='`error_marker`'$(timestamp)' '$(path)'`direnv_status``makeflags_status` `shell_status``vcs_status``guix_env` +PS1='`error_marker`'$(timestamp)' '$(path)'`direnv_status``makeflags_status` `shell_status``vcs_status``guix_env``in_nix_shell` '$(in_ssh_session)'$ ' export PS1 diff --git a/opt/aux/gen-e-list.sh b/opt/aux/gen-e-list.sh index d0586f1..7102e27 100755 --- a/opt/aux/gen-e-list.sh +++ b/opt/aux/gen-e-list.sh @@ -8,6 +8,7 @@ set -eu $XDG_CONFIG_HOME/sh/rc $XDG_CONFIG_HOME/guix/home.scm $XDG_CONFIG_HOME/guix/system.scm + $XDG_CONFIG_HOME/nix/configuration.nix EOF find \ |