summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--channels.scm4
-rw-r--r--home/home.scm3
-rwxr-xr-xscripts/guix-retry21
-rwxr-xr-xscripts/reconfigure-system2
-rwxr-xr-xscripts/reconfigure-user2
-rwxr-xr-xscripts/update-commits73
6 files changed, 67 insertions, 38 deletions
diff --git a/channels.scm b/channels.scm
index fa63fed..62acf7f 100644
--- a/channels.scm
+++ b/channels.scm
@@ -3,7 +3,7 @@
(url "https://git.savannah.gnu.org/git/guix.git")
(branch "master")
(commit
- "c56505e399834a3f68cf2b6715b42f12ceea217a")
+ "9d09b0cf841fb657a1aec12e9bab68e00c2b493c")
(introduction
(make-channel-introduction
"9edb3f66fd807b096b48283debdcddccfea34bad"
@@ -14,7 +14,7 @@
(url "https://gitlab.com/nonguix/nonguix.git")
(branch "master")
(commit
- "720df79727769e4230706e891841ec6f0b8b3890")
+ "4aa03a3ccf6bb693bd4c99900bcd81845c249bbe")
(introduction
(make-channel-introduction
"897c1a470da759236cc11798f4e0a5f7d4d59fbc"
diff --git a/home/home.scm b/home/home.scm
index e199528..5e6a445 100644
--- a/home/home.scm
+++ b/home/home.scm
@@ -20,6 +20,7 @@
(sakura home services pipewire)
(sakura packages gnome-xyz)
(sakura packages sound)
+ (sakura packages hypr)
(sakura packages vim))
@@ -34,7 +35,6 @@
"swaylock-effects"
; hyprland
- "hyprland"
"hyprlock"
"hyprpaper"
"hypridle"
@@ -141,6 +141,7 @@
; add ca certs and ambiguous packages
(list freya-ca-certs
+ hyprland
orchis-theme-2024
blueman-sakura)))
diff --git a/scripts/guix-retry b/scripts/guix-retry
new file mode 100755
index 0000000..c504048
--- /dev/null
+++ b/scripts/guix-retry
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+error="write_to_session_record_port"
+
+# create redirection
+# file descripters
+exec 11>&1 # stdout
+exec 22>&2 # stderr
+
+while true; do
+ # send stdout to stdout
+ # send stderr though pipe
+ output=$("$@" 2>&1 1>&11 | tee >(cat - >&22)) # return stderr to
+ # normal stderr as well
+
+ # check if error is in stderr
+ if echo "$output" | grep -q "$error"; then
+ continue
+ fi
+ break
+done
diff --git a/scripts/reconfigure-system b/scripts/reconfigure-system
index 1e38b42..3d378f3 100755
--- a/scripts/reconfigure-system
+++ b/scripts/reconfigure-system
@@ -1,3 +1,3 @@
#!/bin/sh
repo="$HOME/.config/guix"
-sudo -E guix system -L "$repo/modules" reconfigure "$repo/systems/$(hostname).scm"
+sudo -E guix-retry guix system -L "$repo/modules" reconfigure "$repo/systems/$(hostname).scm"
diff --git a/scripts/reconfigure-user b/scripts/reconfigure-user
index 3a0a602..bdc8ca9 100755
--- a/scripts/reconfigure-user
+++ b/scripts/reconfigure-user
@@ -1,4 +1,4 @@
#!/bin/sh
repo="$HOME/.config/guix"
-guix home -L "$repo/modules" reconfigure "$repo/home/home.scm"
+guix-retry guix home -L "$repo/modules" reconfigure "$repo/home/home.scm"
home-manager switch
diff --git a/scripts/update-commits b/scripts/update-commits
index 9302dcb..15e38b1 100755
--- a/scripts/update-commits
+++ b/scripts/update-commits
@@ -82,12 +82,24 @@
(invoke "git" "ls-remote" git-url "HEAD")
#\tab)))
-(define (commit-timestamp git-url commit)
- ; get the unix timestamp of a <commit> in git repo <git-url>
- (let* ((dir (git-checkout git-url))
- (timestamp
- (invoke "git" "-C" dir "show" "--quiet" "--format=%at" commit)))
- (string->number (string-trim-both timestamp #\newline))))
+(define (git-rev-list git-url local-commit remote-commit)
+ ;; get how many commits ahead the remote commit is
+ ;; from the current local commit
+ ;; - returns 0 if remote-commit is the same or older
+ (if (and (string? local-commit)
+ (string? remote-commit))
+ (let* ((dir (git-checkout git-url))
+ (timestamp
+ ;; git rev-list counts #commits
+ ;; - returns zero if commits out of order (remote older)
+ (invoke "git" "-C" dir "rev-list" "--count"
+ (string-append local-commit
+ ".."
+ remote-commit))))
+ (string->number (string-trim-both timestamp #\newline)))
+ ;; return zero of one of the commit
+ ;; hashes provided is invalid
+ 0))
;;
;; core functions
@@ -109,23 +121,18 @@
(fold (lambda (local-repo commits)
(let* ((repo-id (car local-repo))
(git-url (cadr local-repo))
- ; local
(local-commit (caddr local-repo))
- (local-timestamp (commit-timestamp git-url local-commit))
- ; remote
(remote-commit (assoc-ref remote-commits repo-id))
- (remote-timestamp (if (string? remote-commit)
- (commit-timestamp git-url remote-commit)))
- ; newest
- (newest-commit (if (and (number? remote-timestamp)
- (> remote-timestamp local-timestamp))
- remote-commit))
- ; result
- (result (if (string? newest-commit)
- (cons (list repo-id local-commit newest-commit)
- commits)
- commits)))
- result))
+ (commit-diff (git-rev-list git-url
+ local-commit
+ remote-commit)))
+ ;; dont append these commits to the updated
+ ;; merge list if the remote-commit is not better then
+ ;; what we already have locally
+ (if (> commit-diff 0)
+ (cons (list repo-id local-commit remote-commit)
+ commits)
+ commits)))
'()
local-commits))
@@ -145,7 +152,8 @@
remote-commit)))
(read-file path)
commits)))
- (write-file path result)))
+ (write-file path result)
+ (length commits)))
;;
;; guix functions
@@ -254,15 +262,14 @@
(define %nix-remote-commits
(nix-remote-commits %nix-local-commits))
-(update-file
- %guix-local-commits
- %guix-remote-commits
- %guix-channels-file)
+(if (> (update-file
+ %guix-local-commits
+ %guix-remote-commits
+ %guix-channels-file) 0)
+ (system* "guix-retry" "guix" "pull" "-C" %guix-channels-file))
-(update-file
- %nix-local-commits
- %nix-remote-commits
- %nix-flake-file)
-
-(system* "guix" "pull" "-C" %guix-channels-file)
-(system* "nix" "flake" "lock" (dirname %nix-flake-file))
+(if (> (update-file
+ %nix-local-commits
+ %nix-remote-commits
+ %nix-flake-file) 0)
+ (system* "nix" "flake" "lock" (dirname %nix-flake-file)))