summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Schanzenbacher <ryan@rschanz.org>2023-09-15 20:57:54 -0400
committerRyan Schanzenbacher <ryan@rschanz.org>2023-09-15 20:57:54 -0400
commite2cc3f5f342c9ca80d83e35ce8aa6dc2ff9e468a (patch)
treef4a20b35cf67c8692a37a5e2b7ae4632b61dd328
parenta3a44f9054c186ed519bd01bcf184094fa6aa139 (diff)
test 1 for auto deploy
-rwxr-xr-xdeploy.sh32
-rw-r--r--modules/ryan-config/user_first_run.sh20
2 files changed, 31 insertions, 21 deletions
diff --git a/deploy.sh b/deploy.sh
index 7f14eff..f27d6c9 100755
--- a/deploy.sh
+++ b/deploy.sh
@@ -39,10 +39,10 @@ copy_and_prepare() {
39 # Copy template to root of repo 39 # Copy template to root of repo
40 if [ "$install_type" == "e" ] 40 if [ "$install_type" == "e" ]
41 then 41 then
42 cp ./modules/ryan-config/deploy-templates/HostTemplateEncrypted.scm ./$install_hostname.scm 42 cp ./modules/ryan-config/deploy-templates/HostTemplateEncrypted ./$install_hostname.scm
43 elif [ "$install_type" == "d" ] 43 elif [ "$install_type" == "d" ]
44 then 44 then
45 cp ./modules/ryan-config/deploy-templates/HostTemplate.scm ./$install_hostname.scm 45 cp ./modules/ryan-config/deploy-templates/HostTemplate ./$install_hostname.scm
46 else 46 else
47 echo "Invalid install type (not d or e), bailing!" 47 echo "Invalid install type (not d or e), bailing!"
48 exit 1 48 exit 1
@@ -72,28 +72,15 @@ install_system() {
72install_user_env() { 72install_user_env() {
73 # System should be installed now, we can chroot in and configure the user profile now 73 # System should be installed now, we can chroot in and configure the user profile now
74 # NOTE: This assumes the user "ryan" for things, so change the USER var if you change your username 74 # NOTE: This assumes the user "ryan" for things, so change the USER var if you change your username
75
76 # Mount the special block devices to prepare for chroot
77 mount --rbind /proc /mnt/proc
78 mount --rbind /sys /mnt/sys
79 mount --rbind /dev /mnt/dev
80
81 # chroot into system and run commands
82 # First copy the file
83 cp ~/guix-dotfiles/$install_hostname /mnt/$install_hostname.scm
84 USER=ryan
85 chroot /mnt <<EOT
86
87 # Activate commands
88 source /var/guix/profiles/system/profile/etc/profile
89 /var/guix/profiles/system/activate
90 guix-daemon --build-users-group=guixbuild --disable-chroot &
91 75
92 guix shell git -- git clone https://git.stationery.faith/ryan77627/guix-dotfiles /home/$USER/.config/guix 76 # Copy some files over to prepare for reboot
77 USER=ryan
78 guix shell git -- git clone https://git.stationery.faith/ryan77627/guix-dotfiles /mnt/home/$USER/.config/guix
93 79
94 mv /$install_hostname.scm /home/$USER/.config/guix/$install_hostname.scm 80 cp ~/guix-dotfiles/$install_hostname.scm /mnt/home/$USER/.config/guix/$install_hostname.scm
81 cp ~/guix-dotfiles/modules/ryan-config/user_first_run.sh /mnt/home/$USER/.bashrc
95 82
96 EOT 83 chown 1000:1000 -R /mnt/home/ryan
97 84
98} 85}
99 86
@@ -101,3 +88,6 @@ gather_env
101copy_and_prepare 88copy_and_prepare
102install_system 89install_system
103install_user_env 90install_user_env
91
92# Reboot the machine at this point!
93reboot
diff --git a/modules/ryan-config/user_first_run.sh b/modules/ryan-config/user_first_run.sh
new file mode 100644
index 0000000..6dd77fd
--- /dev/null
+++ b/modules/ryan-config/user_first_run.sh
@@ -0,0 +1,20 @@
1#!/run/current-system/profile/bin/bash
2
3# This should run on user first logon, so let's a go!
4# First, we should run a guix pull
5
6guix pull
7
8hash guix
9
10guix home -L ~/.config/guix/modules reconfigure ~/.config/guix/home-config/home-configuration.scm
11
12sudo herd restart nix-daemon
13
14nix-channel --update
15
16nix-shell '<home-manager>' -A install
17
18source ~/.bashrc
19
20home-manager switch