source: dotfiles/guix/.direnvrc@ 20d7d4d

Last change on this file since 20d7d4d was fcd469c, checked in by Mikhail Kirillov <w96k@…>, on Oct 21, 2020 at 5:48:05 PM

Minor updates

  • Property mode set to 100644
File size: 2.0 KB
Line 
1# Thanks <https://github.com/direnv/direnv/issues/73#issuecomment-152284914>
2export_function()
3{
4 local name=$1
5 local alias_dir=$PWD/.direnv/aliases
6 mkdir -p "$alias_dir"
7 PATH_add "$alias_dir"
8 local target="$alias_dir/$name"
9 if declare -f "$name" >/dev/null; then
10 echo "#!$SHELL" > "$target"
11 declare -f "$name" >> "$target" 2>/dev/null
12 # Notice that we add shell variables to the function trigger.
13 echo "$name \$*" >> "$target"
14 chmod +x "$target"
15 fi
16}
17
18use_guix()
19{
20 # Set GitHub token.
21 export GUIX_GITHUB_TOKEN="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
22
23 # Unset 'GUIX_PACKAGE_PATH'.
24 export GUIX_PACKAGE_PATH=""
25
26 # Recreate a garbage collector root.
27 gcroots="$HOME/.config/guix/gcroots"
28 mkdir -p "$gcroots"
29 gcroot="$gcroots/guix"
30 if [ -L "$gcroot" ]
31 then
32 rm -v "$gcroot"
33 fi
34
35 # Miscellaneous packages.
36 PACKAGES_MAINTENANCE=(
37 direnv
38 git
39 git:send-email
40 git-cal
41 gnupg
42 guile-colorized
43 guile-readline
44 less
45 ncurses
46 openssh
47 xdot
48 )
49
50 # Environment packages.
51 PACKAGES=(help2man guile-sqlite3 guile-gcrypt)
52
53 # Thanks <https://lists.gnu.org/archive/html/guix-devel/2016-09/msg00859.html>
54 eval "$(guix environment --search-paths --root="$gcroot" --pure guix --ad-hoc ${PACKAGES[@]} ${PACKAGES_MAINTENANCE[@]} "$@")"
55
56 # Predefine configure flags.
57 configure()
58 {
59 ./configure --localstatedir=/var --prefix=
60 }
61 export_function configure
62
63 # Run make and optionally build something.
64 build()
65 {
66 make -j 2
67 if [ $# -gt 0 ]
68 then
69 ./pre-inst-env guix build "$@"
70 fi
71 }
72 export_function build
73
74 # Predefine push Git command.
75 push()
76 {
77 git push --set-upstream origin
78 }
79 export_function push
80
81 clear # Clean up the screen.
82 git-cal --author='Your Name' # Show contributions calendar.
83
84 # Show commands help.
85 echo "
86build build a package or just a project if no argument provided
87configure run ./configure with predefined parameters
88push push to upstream Git repository
89"
90}
Note: See TracBrowser for help on using the repository browser.