File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3232 RemainAfterExit = true ;
3333 } ;
3434 path = [
35- pkgs . libuuid
35+ pkgs . util-linuxMinimal
3636 pkgs . jq
3737 pkgs . curl
3838 pkgs . nix
5353 system . extraDependencies = lib . mkForce [ ] ;
5454
5555 # # Disable unused nixos tools
56- system . tools . nixos-version . enable = false ;
57- system . tools . nixos-rebuild . enable = false ;
58- system . tools . nixos-option . enable = false ;
59- system . tools . nixos-generate-config . enable = false ;
60- system . tools . nixos-build-vms . enable = false ;
56+ system . disableInstallerTools = true ;
6157
6258 # # Disable documentation
6359 documentation . enable = false ;
Original file line number Diff line number Diff line change @@ -127,10 +127,25 @@ if [[ $USER_PASSWD ]]; then
127127fi
128128
129129# Build configuration
130- nix build /mnt/etc/nixos#nixosConfigurations.xnode.config.system.build.toplevel --store /mnt
130+ nix build /mnt/etc/nixos#nixosConfigurations.xnode.config.system.build.toplevel --store /mnt --profile /mnt/nix/var/nix/profiles/system
131131
132132# Apply configuration
133- nixos-install --no-root-passwd --no-channel-copy --system ./result
133+ # Based on https://github.com/NixOS/nixpkgs/blob/master/pkgs/by-name/ni/nixos-install/nixos-install.sh and https://github.com/NixOS/nixpkgs/blob/nixos-unstable/pkgs/by-name/ni/nixos-enter/nixos-enter.sh
134+ mkdir -p /mnt/dev /mnt/sys /mnt/proc
135+ chmod 0755 /mnt/dev /mnt/sys /mnt/proc
136+ mount --rbind /dev /mnt/dev
137+ mount --rbind /sys /mnt/sys
138+ mount --rbind /proc /mnt/proc
139+ chroot /mnt /nix/var/nix/profiles/system/sw/bin/bash -c " $( cat << EOL
140+ set -e
141+ /nix/var/nix/profiles/system/activate || true
142+ /nix/var/nix/profiles/system/sw/bin/systemd-tmpfiles --create --remove -E || true
143+ mount --rbind --mkdir / /mnt
144+ mount --make-rslave /mnt
145+ NIXOS_INSTALL_BOOTLOADER=1 /nix/var/nix/profiles/system/bin/switch-to-configuration boot
146+ umount -R /mnt && (rmdir /mnt 2>/dev/null || true)
147+ EOL
148+ ) "
134149
135150# Boot into new OS
136151reboot
You can’t perform that action at this time.
0 commit comments