diff options
-rw-r--r-- | Guix.org | 77 | ||||
-rwxr-xr-x | bin/activate-profiles | 39 | ||||
-rwxr-xr-x | bin/update-profiles | 22 |
3 files changed, 138 insertions, 0 deletions
@@ -1,5 +1,82 @@ | |||
1 | #+TITLE: Guix Configuration file | 1 | #+TITLE: Guix Configuration file |
2 | 2 | ||
3 | * Resources | ||
4 | [[https://guix.gnu.org/manual/en/html_node/index.html][guix]] | ||
5 | [[https://github.com/daviwil/dotfiles/blob/master/Systems.org][daviwil/dotfiles]] | ||
6 | |||
7 | * Managing profiles | ||
8 | Source: [[https://github.com/daviwil/dotfiles/blob/master/Systems.org#profile-management][daviwil/dotfiles]] | ||
9 | ** Activate profiles | ||
10 | |||
11 | #+begin_src sh :tangle bin/activate-profiles :shebang #!/bin/sh | ||
12 | # Source: https://github.com/daviwil/dotfiles/blob/master/Systems.org#profile-management | ||
13 | |||
14 | GREEN='\033[1;32m' | ||
15 | RED='\033[1;30m' | ||
16 | NC='\033[0m' | ||
17 | GUIX_EXTRA_PROFILES=$HOME/.guix-extra-profiles | ||
18 | |||
19 | profiles=$* | ||
20 | if [[ $# -eq 0 ]]; then | ||
21 | profiles="$HOME/.config/guix/manifests/*.scm"; | ||
22 | fi | ||
23 | |||
24 | for profile in $profiles; do | ||
25 | # Remove the path and file extension, if any | ||
26 | profileName=$(basename $profile) | ||
27 | profileName="${profileName%.*}" | ||
28 | profilePath="$GUIX_EXTRA_PROFILES/$profileName" | ||
29 | manifestPath=$HOME/.config/guix/manifests/$profileName.scm | ||
30 | |||
31 | if [ -f $manifestPath ]; then | ||
32 | echo | ||
33 | echo -e "${GREEN}Activating profile:" $manifestPath "${NC}" | ||
34 | echo | ||
35 | |||
36 | mkdir -p $profilePath | ||
37 | guix package --manifest=$manifestPath --profile="$profilePath/$profileName" | ||
38 | |||
39 | # Source the new profile | ||
40 | GUIX_PROFILE="$profilePath/$profileName" | ||
41 | if [ -f $GUIX_PROFILE/etc/profile ]; then | ||
42 | . "$GUIX_PROFILE"/etc/profile | ||
43 | else | ||
44 | echo -e "${RED}Couldn't find profile:" $GUIX_PROFILE/etc/profile "${NC}" | ||
45 | fi | ||
46 | else | ||
47 | echo "No profile found at path" $profilePath | ||
48 | fi | ||
49 | done | ||
50 | |||
51 | #+end_src | ||
52 | |||
53 | ** Update profiles | ||
54 | |||
55 | #+begin_src sh :tangle bin/update-profiles :shebang #!/bin/sh | ||
56 | # Source: https://github.com/daviwil/dotfiles/blob/master/Systems.org#profile-management | ||
57 | |||
58 | GREEN='\033[1;32m' | ||
59 | NC='\033[0m' | ||
60 | GUIX_EXTRA_PROFILES=$HOME/.guix-extra-profiles | ||
61 | |||
62 | profiles=$* | ||
63 | if [[ $# -eq 0 ]]; then | ||
64 | profiles="$GUIX_EXTRA_PROFILES/*"; | ||
65 | fi | ||
66 | |||
67 | for profile in $profiles; do | ||
68 | profileName=$(basename $profile) | ||
69 | profilePath=$GUIX_EXTRA_PROFILES/$profileName | ||
70 | |||
71 | echo | ||
72 | echo -e "${GREEN}Updating profile:" $profilePath "${NC}" | ||
73 | echo | ||
74 | |||
75 | guix package --profile="$profilePath/$profileName" --manifest="$HOME/.config/guix/manifests/$profileName.scm" | ||
76 | done | ||
77 | |||
78 | #+end_src | ||
79 | |||
3 | * Channels | 80 | * Channels |
4 | #+begin_src scheme :tangle .config/guix/channels.scm | 81 | #+begin_src scheme :tangle .config/guix/channels.scm |
5 | (list | 82 | (list |
diff --git a/bin/activate-profiles b/bin/activate-profiles new file mode 100755 index 0000000..a4373cf --- /dev/null +++ b/bin/activate-profiles | |||
@@ -0,0 +1,39 @@ | |||
1 | #!/bin/sh | ||
2 | # Source: https://github.com/daviwil/dotfiles/blob/master/Systems.org#profile-management | ||
3 | |||
4 | GREEN='\033[1;32m' | ||
5 | RED='\033[1;30m' | ||
6 | NC='\033[0m' | ||
7 | GUIX_EXTRA_PROFILES=$HOME/.guix-extra-profiles | ||
8 | |||
9 | profiles=$* | ||
10 | if [[ $# -eq 0 ]]; then | ||
11 | profiles="$HOME/.config/guix/manifests/*.scm"; | ||
12 | fi | ||
13 | |||
14 | for profile in $profiles; do | ||
15 | # Remove the path and file extension, if any | ||
16 | profileName=$(basename $profile) | ||
17 | profileName="${profileName%.*}" | ||
18 | profilePath="$GUIX_EXTRA_PROFILES/$profileName" | ||
19 | manifestPath=$HOME/.config/guix/manifests/$profileName.scm | ||
20 | |||
21 | if [ -f $manifestPath ]; then | ||
22 | echo | ||
23 | echo -e "${GREEN}Activating profile:" $manifestPath "${NC}" | ||
24 | echo | ||
25 | |||
26 | mkdir -p $profilePath | ||
27 | guix package --manifest=$manifestPath --profile="$profilePath/$profileName" | ||
28 | |||
29 | # Source the new profile | ||
30 | GUIX_PROFILE="$profilePath/$profileName" | ||
31 | if [ -f $GUIX_PROFILE/etc/profile ]; then | ||
32 | . "$GUIX_PROFILE"/etc/profile | ||
33 | else | ||
34 | echo -e "${RED}Couldn't find profile:" $GUIX_PROFILE/etc/profile "${NC}" | ||
35 | fi | ||
36 | else | ||
37 | echo "No profile found at path" $profilePath | ||
38 | fi | ||
39 | done | ||
diff --git a/bin/update-profiles b/bin/update-profiles new file mode 100755 index 0000000..81129ec --- /dev/null +++ b/bin/update-profiles | |||
@@ -0,0 +1,22 @@ | |||
1 | #!/bin/sh | ||
2 | # Source: https://github.com/daviwil/dotfiles/blob/master/Systems.org#profile-management | ||
3 | |||
4 | GREEN='\033[1;32m' | ||
5 | NC='\033[0m' | ||
6 | GUIX_EXTRA_PROFILES=$HOME/.guix-extra-profiles | ||
7 | |||
8 | profiles=$* | ||
9 | if [[ $# -eq 0 ]]; then | ||
10 | profiles="$GUIX_EXTRA_PROFILES/*"; | ||
11 | fi | ||
12 | |||
13 | for profile in $profiles; do | ||
14 | profileName=$(basename $profile) | ||
15 | profilePath=$GUIX_EXTRA_PROFILES/$profileName | ||
16 | |||
17 | echo | ||
18 | echo -e "${GREEN}Updating profile:" $profilePath "${NC}" | ||
19 | echo | ||
20 | |||
21 | guix package --profile="$profilePath/$profileName" --manifest="$HOME/.config/guix/manifests/$profileName.scm" | ||
22 | done | ||