1
0
forked from clan/clan-core

install-iso: use disko.makeDiskImage

This commit is contained in:
lassulus 2023-07-28 16:37:10 +02:00
parent 2c4667b1f5
commit 6d0dd33ff1
4 changed files with 67 additions and 3 deletions

View File

@ -6,11 +6,12 @@
modules = [ modules = [
self.nixosModules.installer self.nixosModules.installer
self.inputs.nixos-generators.nixosModules.all-formats self.inputs.nixos-generators.nixosModules.all-formats
self.inputs.disko.nixosModules.disko
]; ];
}; };
in in
{ {
install-iso = installer.config.formats.install-iso; install-iso = self.inputs.disko.lib.lib.makeDiskImage { nixosConfig = installer; };
install-vm-nogui = installer.config.formats.vm-nogui; install-vm-nogui = installer.config.formats.vm-nogui;
install-vm = installer.config.formats.vm; install-vm = installer.config.formats.vm;
}; };

View File

@ -1,5 +1,25 @@
{ {
"nodes": { "nodes": {
"disko": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1690548222,
"narHash": "sha256-EcVjLOpbAuL/y55fLlEl3BNM4FP5Pwtp+6DbTiL6FDM=",
"owner": "nix-community",
"repo": "disko",
"rev": "43f17a8b31c49f6696b8b258d317161afdc7e36b",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "disko",
"type": "github"
}
},
"flake-parts": { "flake-parts": {
"inputs": { "inputs": {
"nixpkgs-lib": [ "nixpkgs-lib": [
@ -74,6 +94,7 @@
}, },
"root": { "root": {
"inputs": { "inputs": {
"disko": "disko",
"flake-parts": "flake-parts", "flake-parts": "flake-parts",
"nixos-generators": "nixos-generators", "nixos-generators": "nixos-generators",
"nixpkgs": "nixpkgs", "nixpkgs": "nixpkgs",

View File

@ -3,6 +3,8 @@
inputs = { inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
disko.url = "github:nix-community/disko";
disko.inputs.nixpkgs.follows = "nixpkgs";
nixos-generators.url = "github:nix-community/nixos-generators"; nixos-generators.url = "github:nix-community/nixos-generators";
nixos-generators.inputs.nixpkgs.follows = "nixpkgs"; nixos-generators.inputs.nixpkgs.follows = "nixpkgs";
flake-parts.url = "github:hercules-ci/flake-parts"; flake-parts.url = "github:hercules-ci/flake-parts";

View File

@ -1,10 +1,16 @@
{ lib { lib
, pkgs , pkgs
, modulesPath
, ... , ...
}: { }: {
systemd.tmpfiles.rules = [ systemd.tmpfiles.rules = [
"d /var/shared 0777 root root - -" "d /var/shared 0777 root root - -"
]; ];
imports = [
(modulesPath + "/profiles/installation-device.nix")
(modulesPath + "/profiles/all-hardware.nix")
(modulesPath + "/profiles/base.nix")
];
services.openssh.settings.PermitRootLogin = "yes"; services.openssh.settings.PermitRootLogin = "yes";
system.activationScripts.root-password = '' system.activationScripts.root-password = ''
mkdir -p /var/shared mkdir -p /var/shared
@ -34,7 +40,41 @@
cat /var/shared/qrcode.utf8 cat /var/shared/qrcode.utf8
fi fi
''; '';
formatConfigs.install-iso = { boot.loader.grub.efiInstallAsRemovable = true;
isoImage.squashfsCompression = "zstd -Xcompression-level 1"; boot.loader.grub.efiSupport = true;
disko.devices = {
disk = {
stick = {
type = "disk";
device = "/vda";
imageSize = "3G";
content = {
type = "gpt";
partitions = {
boot = {
size = "1M";
type = "EF02"; # for grub MBR
};
ESP = {
size = "100M";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
};
};
root = {
size = "100%";
content = {
type = "filesystem";
format = "ext4";
mountpoint = "/";
};
};
};
};
};
};
}; };
} }