Skip to content

Commit

Permalink
feat: more convenience for ISO
Browse files Browse the repository at this point in the history
  • Loading branch information
Swarsel committed Dec 21, 2024
1 parent efca28a commit a073dbc
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 8 deletions.
32 changes: 24 additions & 8 deletions SwarselSystems.org
Original file line number Diff line number Diff line change
Expand Up @@ -1836,14 +1836,14 @@ This is a live environment ISO that I use to bootstrap new systems. It only load

imports = [

inputs.lanzaboote.nixosModules.lanzaboote
inputs.disko.nixosModules.disko
inputs.impermanence.nixosModules.impermanence
inputs.sops-nix.nixosModules.sops
"${modulesPath}/installer/cd-dvd/installation-cd-minimal.nix"
"${modulesPath}/installer/cd-dvd/channel.nix"
inputs.lanzaboote.nixosModules.lanzaboote
inputs.disko.nixosModules.disko
inputs.impermanence.nixosModules.impermanence
inputs.sops-nix.nixosModules.sops
"${modulesPath}/installer/cd-dvd/installation-cd-minimal.nix"
"${modulesPath}/installer/cd-dvd/channel.nix"

"${self}/profiles/iso/minimal.nix"
"${self}/profiles/iso/minimal.nix"

];

Expand All @@ -1865,7 +1865,7 @@ This is a live environment ISO that I use to bootstrap new systems. It only load

users = {
allowNoPasswordLogin = true;
groups.swarsel = {};
groups.swarsel = { };
users = {
swarsel = {
name = "swarsel";
Expand All @@ -1887,6 +1887,18 @@ This is a live environment ISO that I use to bootstrap new systems. It only load
loader.efi.canTouchEfiVariables = true;
};

programs.bash.shellAliases = {
"swarsel-install" = "nix run github:Swarsel/.dotfiles#install --";
};

system.activationScripts.cache = {
text = ''
mkdir -p /home/swarsel/.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}}' | tee /home/swarsel/.local/share/nix/trusted-settings.json > /dev/null
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}}' | tee /root/.local/share/nix/trusted-settings.json > /dev/null
'';
};
systemd = {
services.sshd.wantedBy = lib.mkForce [ "multi-user.target" ];
targets = {
Expand Down Expand Up @@ -3073,6 +3085,8 @@ This program sets up a new NixOS host.
green "Adjusting flake.nix so that the configuration is buildable"
sed -i '/nix-secrets = {/,/^[[:space:]]*};/d' flake.nix
git add flake.nix
else
green "Valid SSH key found! Continuing with installation"
fi
sudo nixos-generate-config --dir /home/"$target_user"/.dotfiles/hosts/nixos/"$target_flake"/
git add /home/"$target_user"/.dotfiles/hosts/nixos/"$target_flake"/hardware-configuration.nix
Expand Down Expand Up @@ -3182,6 +3196,8 @@ This program sets up a new NixOS host.
green "Adjusting flake.nix so that the configuration is buildable"
sed -i '/nix-secrets = {/,/^[[:space:]]*};/d' flake.nix
git add flake.nix
else
green "Valid SSH key found! Continuing with installation"
fi

green "Creating /boot partition"
Expand Down
12 changes: 12 additions & 0 deletions hosts/nixos/iso/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,18 @@ in
loader.efi.canTouchEfiVariables = true;
};

programs.bash.shellAliases = {
"swarsel-install" = "nix run github:Swarsel/.dotfiles#install --";
};

system.activationScripts.cache = {
text = ''
mkdir -p /home/swarsel/.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}}' | tee /home/swarsel/.local/share/nix/trusted-settings.json > /dev/null
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}}' | tee /root/.local/share/nix/trusted-settings.json > /dev/null
'';
};
systemd = {
services.sshd.wantedBy = lib.mkForce [ "multi-user.target" ];
targets = {
Expand Down
2 changes: 2 additions & 0 deletions scripts/swarsel-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ if [[ $local_keys != *"${pub_arr[1]}"* ]]; then
green "Adjusting flake.nix so that the configuration is buildable"
sed -i '/nix-secrets = {/,/^[[:space:]]*};/d' flake.nix
git add flake.nix
else
green "Valid SSH key found! Continuing with installation"
fi

green "Creating /boot partition"
Expand Down
2 changes: 2 additions & 0 deletions scripts/swarsel-rebuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ if [[ $local_keys != *"${pub_arr[1]}"* ]]; then
green "Adjusting flake.nix so that the configuration is buildable"
sed -i '/nix-secrets = {/,/^[[:space:]]*};/d' flake.nix
git add flake.nix
else
green "Valid SSH key found! Continuing with installation"
fi
sudo nixos-generate-config --dir /home/"$target_user"/.dotfiles/hosts/nixos/"$target_flake"/
git add /home/"$target_user"/.dotfiles/hosts/nixos/"$target_flake"/hardware-configuration.nix
Expand Down

0 comments on commit a073dbc

Please sign in to comment.