diff options
| -rwxr-xr-x | deploy.sh | 32 | ||||
| -rw-r--r-- | modules/ryan-config/user_first_run.sh | 20 |
2 files changed, 31 insertions, 21 deletions
| @@ -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() { | |||
| 72 | install_user_env() { | 72 | install_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 | |||
| 101 | copy_and_prepare | 88 | copy_and_prepare |
| 102 | install_system | 89 | install_system |
| 103 | install_user_env | 90 | install_user_env |
| 91 | |||
| 92 | # Reboot the machine at this point! | ||
| 93 | reboot | ||
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 | |||
| 6 | guix pull | ||
| 7 | |||
| 8 | hash guix | ||
| 9 | |||
| 10 | guix home -L ~/.config/guix/modules reconfigure ~/.config/guix/home-config/home-configuration.scm | ||
| 11 | |||
| 12 | sudo herd restart nix-daemon | ||
| 13 | |||
| 14 | nix-channel --update | ||
| 15 | |||
| 16 | nix-shell '<home-manager>' -A install | ||
| 17 | |||
| 18 | source ~/.bashrc | ||
| 19 | |||
| 20 | home-manager switch | ||
