fix: adapt local installer script

This commit is contained in:
Leon Schwarzäugl 2025-07-05 03:49:26 +02:00
parent b490763245
commit 4b439fd3e7
Signed by: swarsel
GPG key ID: 26A54C31F2A4FD84
4 changed files with 27 additions and 78 deletions

View file

@ -2859,7 +2859,7 @@ This is a slim setup for developing base configuration. I do not track the hardw
swapSize = "2G"; swapSize = "2G";
# rootDisk = "/dev/nvme0n1"; # rootDisk = "/dev/nvme0n1";
rootDisk = "/dev/vda"; rootDisk = "/dev/vda";
profiles.btrfs = lib.mkIf minimal true; profiles.btrfs = true;
# rootDisk = "/dev/vda"; # rootDisk = "/dev/vda";
} }
sharedOptions; sharedOptions;
@ -3253,7 +3253,7 @@ I also set the =WLR_RENDERER_ALLOW_SOFTWARE=1= to allow this configuration to ru
:END: :END:
#+begin_src nix-ts :tangle hosts/nixos/chaostheatre/default.nix #+begin_src nix-ts :tangle hosts/nixos/chaostheatre/default.nix
{ self, inputs, config, pkgs, lib, ... }: { self, config, pkgs, lib, minimal, ... }:
let let
mainUser = "demo"; mainUser = "demo";
sharedOptions = { sharedOptions = {
@ -3262,7 +3262,8 @@ I also set the =WLR_RENDERER_ALLOW_SOFTWARE=1= to allow this configuration to ru
isLinux = true; isLinux = true;
isPublic = true; isPublic = true;
profiles = { profiles = {
chaostheatre = true; chaostheatre = lib.mkIf (!minimal) true;
minimal = lib.mkIf minimal true;
}; };
}; };
in in
@ -3274,15 +3275,6 @@ I also set the =WLR_RENDERER_ALLOW_SOFTWARE=1= to allow this configuration to ru
{ {
_module.args.diskDevice = config.swarselsystems.rootDisk; _module.args.diskDevice = config.swarselsystems.rootDisk;
} }
"${self}/hosts/nixos/chaostheatre/options.nix"
inputs.home-manager.nixosModules.home-manager
{
home-manager.users."${mainUser}".imports = [
"${self}/modules/home/common/settings.nix"
"${self}/hosts/nixos/chaostheatre/options-home.nix"
"${self}/modules/home/common/sharedsetup.nix"
];
}
]; ];
environment.variables = { environment.variables = {
@ -3312,6 +3304,7 @@ I also set the =WLR_RENDERER_ALLOW_SOFTWARE=1= to allow this configuration to ru
isSwap = true; isSwap = true;
swapSize = "4G"; swapSize = "4G";
rootDisk = "/dev/vda"; rootDisk = "/dev/vda";
profiles.btrfs = true;
} }
sharedOptions; sharedOptions;
@ -15042,34 +15035,8 @@ Autoformatting always puts the =EOF= with indentation, which makes shfmt check f
if [[ $local_keys != *"${pub_arr[1]}"* ]]; then if [[ $local_keys != *"${pub_arr[1]}"* ]]; then
yellow "The ssh key for this configuration is not available." yellow "The ssh key for this configuration is not available."
green "Adjusting flake.nix so that the configuration is buildable ..." green "Adjusting flake.nix so that the configuration is buildable ..."
sed -i '/nix-secrets = {/,/^[[:space:]]*};/d' flake.nix
sed -i '/vbc-nix = {/,/^[[:space:]]*};/d' flake.nix sed -i '/vbc-nix = {/,/^[[:space:]]*};/d' flake.nix
sed -i '/[[:space:]]*\/\/ (inputs.vbc-nix.overlays.default final prev)/d' overlays/default.nix sed -i '/[[:space:]]*\/\/ (inputs.vbc-nix.overlays.default final prev)/d' overlays/default.nix
rm modules/home/common/env.nix
rm modules/home/common/gammastep.nix
rm modules/home/common/git.nix
rm modules/home/common/mail.nix
rm modules/home/common/yubikey.nix
rm modules/nixos/server/restic.nix
rm hosts/nixos/sync/default.nix
rm -rf modules/nixos/server
rm -rf modules/home/server
cat > hosts/nixos/chaostheatre/options-home.nix << EOF
{ self, lib, ... }:
{
options = {
swarselsystems = {
modules = {
yubikey = lib.mkEnableOption "dummy option for chaostheatre";
env = lib.mkEnableOption "dummy option for chaostheatre";
git = lib.mkEnableOption "dummy option for chaostheatre";
mail = lib.mkEnableOption "dummy option for chaostheatre";
gammastep = lib.mkEnableOption "dummy option for chaostheatre";
};
};
};
}
EOF
nix flake update vbc-nix nix flake update vbc-nix
git add . git add .
else else
@ -15144,10 +15111,20 @@ Autoformatting always puts the =EOF= with indentation, which makes shfmt check f
sudo mkdir -p /root/.local/share/nix/ sudo mkdir -p /root/.local/share/nix/
printf '{\"extra-substituters\":{\"https://nix-community.cachix.org\":true,\"https://nix-community.cachix.org https://cache.ngi0.nixos.org/\":true},\"extra-trusted-public-keys\":{\"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=\":true,\"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs= cache.ngi0.nixos.org-1:KqH5CBLNSyX184S9BKZJo1LxrxJ9ltnY2uAs5c/f1MA=\":true}}' | sudo tee /root/.local/share/nix/trusted-settings.json > /dev/null printf '{\"extra-substituters\":{\"https://nix-community.cachix.org\":true,\"https://nix-community.cachix.org https://cache.ngi0.nixos.org/\":true},\"extra-trusted-public-keys\":{\"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=\":true,\"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs= cache.ngi0.nixos.org-1:KqH5CBLNSyX184S9BKZJo1LxrxJ9ltnY2uAs5c/f1MA=\":true}}' | sudo tee /root/.local/share/nix/trusted-settings.json > /dev/null
green "Installing flake $target_config" green "Installing flake $target_config"
sudo nixos-install --flake .#"$target_config"
store_path=$(nix build --no-link --print-out-paths .#nixosConfigurationsMinimal."$target_config".config.system.build.toplevel)
green "Linking generation in bootloader"
sudo "/run/current-system/sw/bin/nix-env --profile /nix/var/nix/profiles/system --set $store_path"
green "Setting generation to activate upon next boot"
sudo "$store_path/bin/switch-to-configuration boot"
green "Installation finished! Reboot to see changes" green "Installation finished! Reboot to see changes"
#+end_src #+end_src
#+RESULTS:
| trap: | undefined | signal: | exit | | | | |
| [ | Babel | evaluation | exited | with | code | 1 | ] |
#+begin_src nix-ts :tangle pkgs/swarsel-install/default.nix #+begin_src nix-ts :tangle pkgs/swarsel-install/default.nix

View file

@ -92,34 +92,8 @@ cd .dotfiles
if [[ $local_keys != *"${pub_arr[1]}"* ]]; then if [[ $local_keys != *"${pub_arr[1]}"* ]]; then
yellow "The ssh key for this configuration is not available." yellow "The ssh key for this configuration is not available."
green "Adjusting flake.nix so that the configuration is buildable ..." green "Adjusting flake.nix so that the configuration is buildable ..."
sed -i '/nix-secrets = {/,/^[[:space:]]*};/d' flake.nix
sed -i '/vbc-nix = {/,/^[[:space:]]*};/d' flake.nix sed -i '/vbc-nix = {/,/^[[:space:]]*};/d' flake.nix
sed -i '/[[:space:]]*\/\/ (inputs.vbc-nix.overlays.default final prev)/d' overlays/default.nix sed -i '/[[:space:]]*\/\/ (inputs.vbc-nix.overlays.default final prev)/d' overlays/default.nix
rm modules/home/common/env.nix
rm modules/home/common/gammastep.nix
rm modules/home/common/git.nix
rm modules/home/common/mail.nix
rm modules/home/common/yubikey.nix
rm modules/nixos/server/restic.nix
rm hosts/nixos/sync/default.nix
rm -rf modules/nixos/server
rm -rf modules/home/server
cat > hosts/nixos/chaostheatre/options-home.nix << EOF
{ self, lib, ... }:
{
options = {
swarselsystems = {
modules = {
yubikey = lib.mkEnableOption "dummy option for chaostheatre";
env = lib.mkEnableOption "dummy option for chaostheatre";
git = lib.mkEnableOption "dummy option for chaostheatre";
mail = lib.mkEnableOption "dummy option for chaostheatre";
gammastep = lib.mkEnableOption "dummy option for chaostheatre";
};
};
};
}
EOF
nix flake update vbc-nix nix flake update vbc-nix
git add . git add .
else else
@ -194,5 +168,10 @@ git add /home/"$target_user"/.dotfiles/hosts/nixos/"$target_config"/hardware-con
sudo mkdir -p /root/.local/share/nix/ sudo mkdir -p /root/.local/share/nix/
printf '{\"extra-substituters\":{\"https://nix-community.cachix.org\":true,\"https://nix-community.cachix.org https://cache.ngi0.nixos.org/\":true},\"extra-trusted-public-keys\":{\"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=\":true,\"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs= cache.ngi0.nixos.org-1:KqH5CBLNSyX184S9BKZJo1LxrxJ9ltnY2uAs5c/f1MA=\":true}}' | sudo tee /root/.local/share/nix/trusted-settings.json > /dev/null printf '{\"extra-substituters\":{\"https://nix-community.cachix.org\":true,\"https://nix-community.cachix.org https://cache.ngi0.nixos.org/\":true},\"extra-trusted-public-keys\":{\"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=\":true,\"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs= cache.ngi0.nixos.org-1:KqH5CBLNSyX184S9BKZJo1LxrxJ9ltnY2uAs5c/f1MA=\":true}}' | sudo tee /root/.local/share/nix/trusted-settings.json > /dev/null
green "Installing flake $target_config" green "Installing flake $target_config"
sudo nixos-install --flake .#"$target_config"
store_path=$(nix build --no-link --print-out-paths .#nixosConfigurationsMinimal."$target_config".config.system.build.toplevel)
green "Linking generation in bootloader"
sudo "/run/current-system/sw/bin/nix-env --profile /nix/var/nix/profiles/system --set $store_path"
green "Setting generation to activate upon next boot"
sudo "$store_path/bin/switch-to-configuration boot"
green "Installation finished! Reboot to see changes" green "Installation finished! Reboot to see changes"

View file

@ -1,4 +1,4 @@
{ self, inputs, config, pkgs, lib, ... }: { self, config, pkgs, lib, minimal, ... }:
let let
mainUser = "demo"; mainUser = "demo";
sharedOptions = { sharedOptions = {
@ -7,7 +7,8 @@ let
isLinux = true; isLinux = true;
isPublic = true; isPublic = true;
profiles = { profiles = {
chaostheatre = true; chaostheatre = lib.mkIf (!minimal) true;
minimal = lib.mkIf minimal true;
}; };
}; };
in in
@ -19,15 +20,6 @@ in
{ {
_module.args.diskDevice = config.swarselsystems.rootDisk; _module.args.diskDevice = config.swarselsystems.rootDisk;
} }
"${self}/hosts/nixos/chaostheatre/options.nix"
inputs.home-manager.nixosModules.home-manager
{
home-manager.users."${mainUser}".imports = [
"${self}/modules/home/common/settings.nix"
"${self}/hosts/nixos/chaostheatre/options-home.nix"
"${self}/modules/home/common/sharedsetup.nix"
];
}
]; ];
environment.variables = { environment.variables = {
@ -57,6 +49,7 @@ in
isSwap = true; isSwap = true;
swapSize = "4G"; swapSize = "4G";
rootDisk = "/dev/vda"; rootDisk = "/dev/vda";
profiles.btrfs = true;
} }
sharedOptions; sharedOptions;

View file

@ -35,7 +35,7 @@ in
swapSize = "2G"; swapSize = "2G";
# rootDisk = "/dev/nvme0n1"; # rootDisk = "/dev/nvme0n1";
rootDisk = "/dev/vda"; rootDisk = "/dev/vda";
profiles.btrfs = lib.mkIf minimal true; profiles.btrfs = true;
# rootDisk = "/dev/vda"; # rootDisk = "/dev/vda";
} }
sharedOptions; sharedOptions;