Install disko in the ISOs.
This commit is contained in:
parent
614ef2e5cf
commit
4276f63c59
@ -19,6 +19,7 @@
|
|||||||
./roles/chromium
|
./roles/chromium
|
||||||
./roles/d2
|
./roles/d2
|
||||||
./roles/direnv
|
./roles/direnv
|
||||||
|
./roles/disko
|
||||||
./roles/distributed_build
|
./roles/distributed_build
|
||||||
./roles/doas
|
./roles/doas
|
||||||
./roles/docker
|
./roles/docker
|
||||||
|
|||||||
@ -6,12 +6,13 @@
|
|||||||
#
|
#
|
||||||
# Install on a new machine:
|
# Install on a new machine:
|
||||||
#
|
#
|
||||||
|
# Set
|
||||||
|
# me.disko.enable = true;
|
||||||
|
# me.disko.offline.enable = true;
|
||||||
#
|
#
|
||||||
# doas nix --substituters "http://10.0.2.2:8080?trusted=1 https://cache.nixos.org/" --experimental-features "nix-command flakes" run github:nix-community/disko/latest -- --mode destroy,format,mount hosts/odo/disk-config.nix
|
# Run
|
||||||
|
# doas disko --mode destroy,format,mount hosts/recovery/disk-config.nix
|
||||||
# for f in /persist/manual/manual_add_to_store/*; do nix-store --add-fixed sha256 "$f"; done
|
# doas nixos-install --substituters "http://10.0.2.2:8080?trusted=1 https://cache.nixos.org/" --flake ".#recovery"
|
||||||
# nixos-install --substituters "http://10.0.2.2:8080?trusted=1 https://cache.nixos.org/" --flake ".#vm_ionlybootzfs"
|
|
||||||
#
|
|
||||||
|
|
||||||
{
|
{
|
||||||
description = "My system configuration";
|
description = "My system configuration";
|
||||||
@ -32,6 +33,7 @@
|
|||||||
|
|
||||||
outputs =
|
outputs =
|
||||||
{
|
{
|
||||||
|
self,
|
||||||
nixpkgs,
|
nixpkgs,
|
||||||
nixpkgs-unoptimized,
|
nixpkgs-unoptimized,
|
||||||
disko,
|
disko,
|
||||||
@ -57,6 +59,10 @@
|
|||||||
nixpkgs.lib.nixosSystem {
|
nixpkgs.lib.nixosSystem {
|
||||||
inherit (nodeConfig) system;
|
inherit (nodeConfig) system;
|
||||||
specialArgs = {
|
specialArgs = {
|
||||||
|
inherit self;
|
||||||
|
|
||||||
|
this_nixos_config = self.nixosConfigurations."${hostname}";
|
||||||
|
|
||||||
pkgs-unoptimized = import nixpkgs-unoptimized {
|
pkgs-unoptimized = import nixpkgs-unoptimized {
|
||||||
inherit (nodeConfig) system;
|
inherit (nodeConfig) system;
|
||||||
hostPlatform.gcc.arch = "default";
|
hostPlatform.gcc.arch = "default";
|
||||||
|
|||||||
@ -14,10 +14,15 @@
|
|||||||
isoImage.makeUsbBootable = true;
|
isoImage.makeUsbBootable = true;
|
||||||
|
|
||||||
me.buildingPortable = true;
|
me.buildingPortable = true;
|
||||||
|
me.disko.enable = true;
|
||||||
|
me.disko.offline.enable = true;
|
||||||
me.mountPersistence = lib.mkForce false;
|
me.mountPersistence = lib.mkForce false;
|
||||||
me.optimizations.enable = lib.mkForce false;
|
me.optimizations.enable = lib.mkForce false;
|
||||||
|
|
||||||
# Not doing image_based_appliance because this might be an install ISO, in which case we'd need nix to do the install.
|
# Not doing image_based_appliance because this might be an install ISO, in which case we'd need nix to do the install.
|
||||||
# me.image_based_appliance.enable = true;
|
# me.image_based_appliance.enable = true;
|
||||||
|
|
||||||
|
# TODO: Should I use this instead of doing a mkIf for the disk config?
|
||||||
|
# disko.enableConfig = false;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@ -39,6 +39,7 @@
|
|||||||
system_features = [
|
system_features = [
|
||||||
"gccarch-znver4"
|
"gccarch-znver4"
|
||||||
"gccarch-skylake"
|
"gccarch-skylake"
|
||||||
|
"gccarch-kabylake"
|
||||||
# "gccarch-alderlake" missing WAITPKG
|
# "gccarch-alderlake" missing WAITPKG
|
||||||
"gccarch-x86-64-v3"
|
"gccarch-x86-64-v3"
|
||||||
"gccarch-x86-64-v4"
|
"gccarch-x86-64-v4"
|
||||||
|
|||||||
@ -38,6 +38,7 @@
|
|||||||
system_features = [
|
system_features = [
|
||||||
"gccarch-znver4"
|
"gccarch-znver4"
|
||||||
"gccarch-skylake"
|
"gccarch-skylake"
|
||||||
|
"gccarch-kabylake"
|
||||||
# "gccarch-alderlake" missing WAITPKG
|
# "gccarch-alderlake" missing WAITPKG
|
||||||
"gccarch-x86-64-v3"
|
"gccarch-x86-64-v3"
|
||||||
"gccarch-x86-64-v4"
|
"gccarch-x86-64-v4"
|
||||||
|
|||||||
@ -94,6 +94,7 @@
|
|||||||
nix.settings.system-features = lib.mkForce [
|
nix.settings.system-features = lib.mkForce [
|
||||||
"gccarch-znver4"
|
"gccarch-znver4"
|
||||||
"gccarch-skylake"
|
"gccarch-skylake"
|
||||||
|
"gccarch-kabylake"
|
||||||
# "gccarch-alderlake" missing WAITPKG
|
# "gccarch-alderlake" missing WAITPKG
|
||||||
"gccarch-x86-64-v3"
|
"gccarch-x86-64-v3"
|
||||||
"gccarch-x86-64-v4"
|
"gccarch-x86-64-v4"
|
||||||
|
|||||||
@ -34,6 +34,7 @@
|
|||||||
system_features = [
|
system_features = [
|
||||||
"gccarch-znver4"
|
"gccarch-znver4"
|
||||||
"gccarch-skylake"
|
"gccarch-skylake"
|
||||||
|
"gccarch-kabylake"
|
||||||
# "gccarch-alderlake" missing WAITPKG
|
# "gccarch-alderlake" missing WAITPKG
|
||||||
"gccarch-x86-64-v3"
|
"gccarch-x86-64-v3"
|
||||||
"gccarch-x86-64-v4"
|
"gccarch-x86-64-v4"
|
||||||
|
|||||||
@ -33,6 +33,7 @@
|
|||||||
"gccarch-znver4"
|
"gccarch-znver4"
|
||||||
"gccarch-znver5"
|
"gccarch-znver5"
|
||||||
"gccarch-skylake"
|
"gccarch-skylake"
|
||||||
|
"gccarch-kabylake"
|
||||||
# "gccarch-alderlake" missing WAITPKG
|
# "gccarch-alderlake" missing WAITPKG
|
||||||
"gccarch-x86-64-v3"
|
"gccarch-x86-64-v3"
|
||||||
"gccarch-x86-64-v4"
|
"gccarch-x86-64-v4"
|
||||||
|
|||||||
@ -25,7 +25,7 @@
|
|||||||
me.mountPersistence = true;
|
me.mountPersistence = true;
|
||||||
|
|
||||||
me.optimizations = {
|
me.optimizations = {
|
||||||
enable = true;
|
# enable = true;
|
||||||
arch = "kabylake";
|
arch = "kabylake";
|
||||||
# build_arch = "x86-64-v3";
|
# build_arch = "x86-64-v3";
|
||||||
system_features = [
|
system_features = [
|
||||||
|
|||||||
75
nix/configuration/roles/disko/default.nix
Normal file
75
nix/configuration/roles/disko/default.nix
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
self,
|
||||||
|
this_nixos_config,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
|
let
|
||||||
|
flakeOutPaths =
|
||||||
|
let
|
||||||
|
collector =
|
||||||
|
parent:
|
||||||
|
map (
|
||||||
|
child:
|
||||||
|
[ child.outPath ] ++ (if child ? inputs && child.inputs != { } then (collector child) else [ ])
|
||||||
|
) (lib.attrValues parent.inputs);
|
||||||
|
in
|
||||||
|
lib.unique (lib.flatten (collector self));
|
||||||
|
dependencies = [
|
||||||
|
# this_nixos_config.config.system.build.toplevel
|
||||||
|
this_nixos_config.config.system.build.diskoScript
|
||||||
|
# this_nixos_config.config.system.build.diskoScript.drvPath
|
||||||
|
this_nixos_config.pkgs.stdenv.drvPath
|
||||||
|
|
||||||
|
# https://github.com/NixOS/nixpkgs/blob/f2fd33a198a58c4f3d53213f01432e4d88474956/nixos/modules/system/activation/top-level.nix#L342
|
||||||
|
this_nixos_config.pkgs.perlPackages.ConfigIniFiles
|
||||||
|
this_nixos_config.pkgs.perlPackages.FileSlurp
|
||||||
|
|
||||||
|
(this_nixos_config.pkgs.closureInfo { rootPaths = [ ]; }).drvPath
|
||||||
|
]
|
||||||
|
++ flakeOutPaths;
|
||||||
|
closureInfo = pkgs.closureInfo { rootPaths = dependencies; };
|
||||||
|
in
|
||||||
|
{
|
||||||
|
imports = [ ];
|
||||||
|
|
||||||
|
options.me = {
|
||||||
|
disko.enable = lib.mkOption {
|
||||||
|
type = lib.types.bool;
|
||||||
|
default = false;
|
||||||
|
example = true;
|
||||||
|
description = "Whether we want to install disko.";
|
||||||
|
};
|
||||||
|
|
||||||
|
disko.offline.enable = lib.mkOption {
|
||||||
|
type = lib.types.bool;
|
||||||
|
default = false;
|
||||||
|
example = true;
|
||||||
|
description = "Whether we want to install disko.";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf config.me.disko.enable (
|
||||||
|
lib.mkMerge [
|
||||||
|
{
|
||||||
|
environment.systemPackages = with pkgs; [
|
||||||
|
disko
|
||||||
|
];
|
||||||
|
}
|
||||||
|
(lib.mkIf config.me.disko.offline.enable {
|
||||||
|
environment.systemPackages = with pkgs; [
|
||||||
|
(pkgs.writeShellScriptBin "install-nixos-unattended" ''
|
||||||
|
set -xeuo pipefail
|
||||||
|
IFS=$'\n\t'
|
||||||
|
exec ${pkgs.disko}/bin/disko-install --flake '${self}#${config.networking.hostName}' --disk main '/dev/nvme0n1'
|
||||||
|
'')
|
||||||
|
];
|
||||||
|
|
||||||
|
environment.etc."install-closure".source = "${closureInfo}/store-paths";
|
||||||
|
})
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
@ -64,6 +64,7 @@ in
|
|||||||
"gccarch-x86-64-v3"
|
"gccarch-x86-64-v3"
|
||||||
"gccarch-x86-64-v4"
|
"gccarch-x86-64-v4"
|
||||||
"gccarch-skylake"
|
"gccarch-skylake"
|
||||||
|
"gccarch-kabylake"
|
||||||
"gccarch-znver4"
|
"gccarch-znver4"
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@ -93,6 +94,7 @@ in
|
|||||||
"gccarch-x86-64-v3"
|
"gccarch-x86-64-v3"
|
||||||
"gccarch-x86-64-v4"
|
"gccarch-x86-64-v4"
|
||||||
"gccarch-skylake"
|
"gccarch-skylake"
|
||||||
|
"gccarch-kabylake"
|
||||||
"gccarch-znver4"
|
"gccarch-znver4"
|
||||||
"gccarch-znver5"
|
"gccarch-znver5"
|
||||||
];
|
];
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user