Skip to content

Commit

Permalink
Generate one script per target
Browse files Browse the repository at this point in the history
  • Loading branch information
FaustXVI committed Jan 3, 2025
1 parent 50c64b1 commit 8df26f1
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@
export SOPS_AGE_KEY_FILE="''$(pwd)/keys/ageKey.txt";
'';
};
installIso = builtins.foldl' (set: target: set // { "${target}" = import ./install/iso.nix (inputs // { inherit system pkgs target; }); }) { } targets;
testInstallIso = builtins.foldl' (set: target: set // { "${target}" = import ./install/testIso.nix { inherit pkgs target self; }; }) { } targets;
installIso = import ./install/iso.nix (inputs // { inherit system pkgs targets; });
testInstallIso = import ./install/testIso.nix { inherit pkgs self; };
nixosConfigurations = builtins.foldl' (set: name: set // { "${name}" = nixosMachine "${name}"; }) { } targets;
};
}
10 changes: 6 additions & 4 deletions install/iso.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{ self, system, nixpkgs, pkgs, target, ... }:
{ self, system, nixpkgs, pkgs, targets, ... }:
let
scripts = builtins.map (target: self.packages."${system}"."install-script-${target}") targets;
in
(nixpkgs.lib.nixosSystem {
inherit system;
modules = [
Expand All @@ -7,7 +10,7 @@
({config, ...}:{
isoImage = {
squashfsCompression = "gzip -Xcompression-level 1";
isoBaseName = "nixos-xadet-${target}-installer-${config.system.nixos.release}";
isoBaseName = "nixos-xadet-installer-${config.system.nixos.release}";
};
console.keyMap = "fr";
nix = {
Expand All @@ -17,8 +20,7 @@
};
environment.systemPackages = [
pkgs.nixos-facter
self.packages."${system}"."install-script-${target}"
];
] ++ scripts;
services.xserver.xkb = {
layout = "fr";
};
Expand Down
8 changes: 3 additions & 5 deletions install/testIso.nix
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
# This module defines a small NixOS installation CD. It does not
# contain any graphical stuff.
{ self, pkgs, target, ... }:
pkgs.writeShellScriptBin "test-install-${target}" ''
{ self, pkgs, ... }:
pkgs.writeShellScriptBin "test-install-xadet" ''
DISK_NAME="disk-75G.qcow2"
qemu-img create -f qcow2 "$DISK_NAME" 75G
qemu-system-x86_64 -bios ${pkgs.OVMF.fd}/FV/OVMF.fd \
-enable-kvm -m 6G -cdrom ${self.installIso.${target}}/iso/*.iso -hda "$DISK_NAME" "$@"
-enable-kvm -m 6G -cdrom ${self.installIso}/iso/*.iso -hda "$DISK_NAME" "$@"
''

0 comments on commit 8df26f1

Please sign in to comment.