Skip to content

Commit

Permalink
notes
Browse files Browse the repository at this point in the history
  • Loading branch information
BostX committed Apr 19, 2024
1 parent faf4676 commit 130275e
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 29 deletions.
2 changes: 1 addition & 1 deletion notes/cli/linux.scrbl
Original file line number Diff line number Diff line change
Expand Up @@ -785,7 +785,7 @@
# recursively diff / compare directories, show only filenames
# -q, --brief report only when files differ
# -r, --recursive
diff --brief --recursive dirA dirB --exclude '*.log' | sort
diff --brief --recursive dirA dirB --exclude '*.log' --exclude '*.gz' | sort
#
# outputs the files in two columns, side by side, separated by spaces
sdiff file1 file0
Expand Down
16 changes: 8 additions & 8 deletions notes/guix-guile-nix/guile.scrbl
Original file line number Diff line number Diff line change
Expand Up @@ -127,14 +127,14 @@
(define* (partial fun #:rest args)
(lambda x (apply fun (append args x))))

(define* (fun x #:key kw (kw-opt #f) #:rest args)
"kw-opt is a keyword and optional argument at the same time"
;; (apply list p kw kw-opt args) ;; flattens the output list
(list x kw kw-opt args))
(define* (fun x y #:key kw (kw-opt1 'o1) (kw-opt2 'o2) #:rest args)
"kw-opt1, kw-opt2 are keywords and optional arguments at the same time"
(list x y kw kw-opt1 kw-opt2 args))
;;
(fun 'x #:kw '42 'args) ;; (x 42 #f (#:kw 42 args))
(fun 'x #:kw '42 #:kw-opt 'x 'args) ;; (x 42 x (#:kw 42 #:kw-opt x args))
(apply fun (list 'x #:kw '42 'args));; (x 42 #f (#:kw 42 args))
(fun 'x #:kw '42 'args) ; (x #:kw #f o1 o2 (42 args))
(apply fun (list 'x #:kw '42 'args)) ; (x #:kw #f o1 o2 (42 args))
(fun 'x 'y #:kw '42 #:kw-opt1 'ox #:kw-opt2 'oy 'args)
;; (x y 42 ox oy (#:kw 42 #:kw-opt1 ox #:kw-opt2 oy args))

(define* (fun x #:optional (y 'y-default-val))
(list x y))
Expand Down Expand Up @@ -332,7 +332,7 @@

;; TODO see 'push all branches to all remotes'
;; https://stackoverflow.com/a/18674313/5151982

(use-modules (ice-9 regex)) ;; string-match
(define (main args)
((compose
(partial format #t "~a\n")
Expand Down
20 changes: 15 additions & 5 deletions notes/guix-guile-nix/guix_package.scrbl
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,18 @@

guix graph --type=reverse-package
guix graph --path
# visualize package dependencies
guix graph coreutils | xdot -

# visualize dependencies of / packages needed by / packages required by:
guix graph coreutils | xdot - & disown
guix graph coreutils | dot -Tpdf > dag.pdf

# visualize dependencies of / packages needed by / packages required by
# including implicit inputs:
guix graph --type=bag-emerged coreutils | xdot - & disown
guix graph --type=bag-emerged coreutils | dot -Tpdf > dag.pdf

# packages that explicitly depend on:
guix graph --type=reverse-package ocaml
}

@block{@block-name{Package Inputs / Outputs}
Expand Down Expand Up @@ -261,10 +271,10 @@
* (basic) inputs
Built for target architecture. Can be referenced by the package. Will be in
the resulting binary file
* native
* native-inputs
Built for host architecture (the build machine), e.g. built-time utils not
needed during run-time
* propagated
* propagated-inputs
Will be added to user profile along with the package
When a package has propagated inputs then any package that depends on it
will automatically have those inputs available to it.
Expand Down Expand Up @@ -356,7 +366,7 @@
| #~ | gexp | quasiquote; like ` |
| #$ | ungexp | unquote; like , |
| #+ | | same role as #$, but it's a reference to a native package build |
| #$@"@" | ungexp-splicing | unquote-splicing / splice; like ,@ |
| #$@"@" | ungexp-splicing | unquote-splicing / splice; like ,@"@" |

}

Expand Down
35 changes: 20 additions & 15 deletions notes/guix-guile-nix/guix_system_configuration.scrbl
Original file line number Diff line number Diff line change
Expand Up @@ -322,30 +322,35 @@
unset profile
done

$ cd /tmp
# create a new profile 'foo' and install guile in it:
$ guix package --profile=foo --install=guile
cd /tmp
guix package --profile=foo --install=guile

# add vim to the foo-profile:
$ guix package --profile=foo --install=vim
guix package --profile=foo --install=vim

# list structure of the foo-profile:
$ ls -l foo* | awk '{print $9, $10, $11}'
foo -> foo-2-link
foo-1-link -> /gnu/store/lv43kziij7sa1xck7gf1c720393pck65-profile
foo-2-link -> /gnu/store/15ra24gkqkfagzj16672528ivkkb9ya4-profile
$ guix gc --list-roots | rg foo
ls -l foo* | awk '{print $9, $10, $11}'
# foo -> foo-2-link
# foo-1-link -> /gnu/store/lv43kziij7sa1xck7gf1c720393pck65-profile
# foo-2-link -> /gnu/store/15ra24gkqkfagzj16672528ivkkb9ya4-profile
guix gc --list-roots | rg foo

# remove profile just by deleting the links:
rm /tmp/foo-2-link
rm /tmp/foo-1-link
rm foo

# the profile-item may be manually deleted from the store, however it's not
# necessary `guix gc` will auto-remove the store entries for the created
# profile.
$ guix gc --delete /gnu/store/lv43kziij7sa1xck7gf1c720393pck65-profile # foo-2-link
# this (probably) won't work since the current profile point to this store-item I guess
# but I can't find out where/how exactly?
$ guix gc --delete /gnu/store/lv43kziij7sa1xck7gf1c720393pck65-profile # foo-1-link
# profile. foo-2-link:
guix gc --delete /gnu/store/lv43kziij7sa1xck7gf1c720393pck65-profile

# list all user profiles
$ guix gc --list-roots | rg -v $HOME/\.cache\|\(guix-profile\|guix-home\|current-guix\)-[0-9]+-link
# this (probably) won't work since the current profile point to this
# store-item I guess but I can't find out where/how exactly? foo-1-link:
guix gc --delete /gnu/store/lv43kziij7sa1xck7gf1c720393pck65-profile

# list all user profiles; # -v --invert-match
guix gc --list-roots | rg --invert-match \
~/\.cache\|\(guix-profile\|guix-home\|current-guix\)-[0-9]+-link
}

0 comments on commit 130275e

Please sign in to comment.