forked from fediversity/fediversity
rm repart
Signed-off-by: Kiara Grouwstra <kiara@procolix.eu> restore partition case from repart Signed-off-by: Kiara Grouwstra <kiara@procolix.eu>
This commit is contained in:
parent
d9b380d279
commit
6f58d38c45
6 changed files with 2 additions and 231 deletions
|
|
@ -76,7 +76,6 @@ in
|
||||||
machine =
|
machine =
|
||||||
(pkgs.nixos [
|
(pkgs.nixos [
|
||||||
./targetNode.nix
|
./targetNode.nix
|
||||||
# ../../../infra/common/nixos/repart.nix
|
|
||||||
"${modulesPath}/../lib/testing/nixos-test-base.nix"
|
"${modulesPath}/../lib/testing/nixos-test-base.nix"
|
||||||
config.system.extraDependenciesFromModule
|
config.system.extraDependenciesFromModule
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -5,9 +5,6 @@
|
||||||
}:
|
}:
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
# systemd-repart
|
|
||||||
# ../../../../infra/common/nixos/repart.nix
|
|
||||||
# disko
|
|
||||||
"${sources.disko}/module.nix"
|
"${sources.disko}/module.nix"
|
||||||
../../../../infra/common/proxmox-qemu-vm.nix
|
../../../../infra/common/proxmox-qemu-vm.nix
|
||||||
];
|
];
|
||||||
|
|
|
||||||
|
|
@ -328,43 +328,15 @@ let
|
||||||
inherit (ssh)
|
inherit (ssh)
|
||||||
host
|
host
|
||||||
;
|
;
|
||||||
# machine = import nixos_conf;
|
|
||||||
machine = import ./nixos.nix {
|
machine = import ./nixos.nix {
|
||||||
inherit sources system;
|
inherit sources system;
|
||||||
configuration = tf-host.config.nixos-configuration;
|
configuration = tf-host.config.nixos-configuration;
|
||||||
# configuration = { ... }: {
|
|
||||||
# imports = [
|
|
||||||
# tf-host.config.nixos-configuration
|
|
||||||
# ../infra/common/nixos/repart.nix
|
|
||||||
# ];
|
|
||||||
# };
|
|
||||||
};
|
};
|
||||||
# inherit (machine.config.boot.uki) name;
|
|
||||||
name = "monkey";
|
name = "monkey";
|
||||||
|
|
||||||
# # systemd-repart
|
|
||||||
# better for cross-compilation, worse for pre-/post-processing, doesn't support MBR: https://github.com/nix-community/disko/issues/550#issuecomment-2503736973
|
|
||||||
# raw = "${machine.config.system.build.image}/${name}.raw";
|
|
||||||
|
|
||||||
# disko
|
|
||||||
# worse for cross-compilation, better for pre-/post-processing, needs manual `imageSize`, random failures: https://github.com/nix-community/disko/issues/550#issuecomment-2503736973
|
# worse for cross-compilation, better for pre-/post-processing, needs manual `imageSize`, random failures: https://github.com/nix-community/disko/issues/550#issuecomment-2503736973
|
||||||
raw = "${machine.config.system.build.diskoImages}/main.raw";
|
raw = "${machine.config.system.build.diskoImages}/main.raw";
|
||||||
|
|
||||||
# # nixos-generators: note it can straight-up do qcow2 as well, if we settle for nixos-generators
|
|
||||||
# # `mount: /run/nixos-etc-metadata.J3iARWBtna: failed to setup loop device for /nix/store/14ka2bmx6lcnyr8ah2yl787sqcgxz5ni-etc-metadata.erofs.`
|
|
||||||
# # [`Error: Failed to parse os-release`](https://github.com/NixOS/nixpkgs/blob/5b1861820a3bc4ef2f60b0afcffb71ea43f5d000/pkgs/by-name/sw/switch-to-configuration-ng/src/src/main.rs#L151)
|
|
||||||
# raw = let
|
|
||||||
# # TODO parameterize things to let this flow into the terraform
|
|
||||||
# # btw qcow can be made by nixos-generators (qcow, qcow-efi) or by `image.repart`
|
|
||||||
# # wait, so i generate an image for the nixos config from the data model? how would i then propagate that to deploy?
|
|
||||||
# gen = import "${pkgs.nixos-generators}/share/nixos-generator/nixos-generate.nix" {
|
|
||||||
# inherit system formatConfig;
|
|
||||||
# inherit (sources) nixpkgs;
|
|
||||||
# configuration = tf-host.config.nixos-configuration;
|
|
||||||
# };
|
|
||||||
# in
|
|
||||||
# "${gen.config.system.build.${formatAttr}}/nixos${fileExtension}";
|
|
||||||
|
|
||||||
environment = {
|
environment = {
|
||||||
inherit
|
inherit
|
||||||
host
|
host
|
||||||
|
|
@ -384,8 +356,6 @@ let
|
||||||
(withPackages [
|
(withPackages [
|
||||||
pkgs.jq
|
pkgs.jq
|
||||||
pkgs.qemu
|
pkgs.qemu
|
||||||
pkgs.nixos-generators
|
|
||||||
pkgs.httpie
|
|
||||||
(pkgs.callPackage ./run/tf-proxmox-vm/tf.nix { })
|
(pkgs.callPackage ./run/tf-proxmox-vm/tf.nix { })
|
||||||
])
|
])
|
||||||
''
|
''
|
||||||
|
|
@ -573,8 +543,6 @@ let
|
||||||
(withPackages [
|
(withPackages [
|
||||||
pkgs.jq
|
pkgs.jq
|
||||||
pkgs.qemu
|
pkgs.qemu
|
||||||
pkgs.nixos-generators
|
|
||||||
pkgs.httpie
|
|
||||||
(pkgs.callPackage ./run/tf-proxmox-vm/tf.nix { })
|
(pkgs.callPackage ./run/tf-proxmox-vm/tf.nix { })
|
||||||
])
|
])
|
||||||
''
|
''
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,6 @@ in
|
||||||
imports = [
|
imports = [
|
||||||
./networking.nix
|
./networking.nix
|
||||||
./users.nix
|
./users.nix
|
||||||
# ./repart.nix
|
|
||||||
];
|
];
|
||||||
|
|
||||||
time.timeZone = "Europe/Amsterdam";
|
time.timeZone = "Europe/Amsterdam";
|
||||||
|
|
|
||||||
|
|
@ -1,192 +0,0 @@
|
||||||
{
|
|
||||||
config,
|
|
||||||
pkgs,
|
|
||||||
lib,
|
|
||||||
modulesPath,
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
{
|
|
||||||
|
|
||||||
imports = [
|
|
||||||
"${modulesPath}/image/repart.nix"
|
|
||||||
];
|
|
||||||
|
|
||||||
fileSystems = {
|
|
||||||
# "/" = {
|
|
||||||
# fsType = "tmpfs";
|
|
||||||
# options = [
|
|
||||||
# "size=20%"
|
|
||||||
# ];
|
|
||||||
# };
|
|
||||||
"/" =
|
|
||||||
let
|
|
||||||
partConf = config.image.repart.partitions."root".repartConfig;
|
|
||||||
in
|
|
||||||
{
|
|
||||||
device = "/dev/disk/by-partuuid/${partConf.UUID}";
|
|
||||||
fsType = partConf.Format;
|
|
||||||
};
|
|
||||||
|
|
||||||
# "/var" =
|
|
||||||
# let
|
|
||||||
# partConf = config.image.repart.partitions."var".repartConfig;
|
|
||||||
# in
|
|
||||||
# {
|
|
||||||
# device = "/dev/disk/by-partuuid/${partConf.UUID}";
|
|
||||||
# fsType = partConf.Format;
|
|
||||||
# };
|
|
||||||
|
|
||||||
"/boot" =
|
|
||||||
let
|
|
||||||
partConf = config.image.repart.partitions."esp".repartConfig;
|
|
||||||
in
|
|
||||||
{
|
|
||||||
device = "/dev/disk/by-partuuid/${partConf.UUID}";
|
|
||||||
fsType = partConf.Format;
|
|
||||||
};
|
|
||||||
|
|
||||||
# "/nix/store" =
|
|
||||||
# let
|
|
||||||
# partConf = config.image.repart.partitions."store".repartConfig;
|
|
||||||
# in
|
|
||||||
# {
|
|
||||||
# device = "/dev/disk/by-partlabel/${partConf.Label}";
|
|
||||||
# fsType = partConf.Format;
|
|
||||||
# };
|
|
||||||
};
|
|
||||||
|
|
||||||
boot.uki.name = "monkey";
|
|
||||||
# fileSystems."/".device = "/dev/disk/by-label/nixos";
|
|
||||||
# https://nixos.org/manual/nixos/stable/#sec-image-repart
|
|
||||||
# https://x86.lol/generic/2024/08/28/systemd-sysupdate.html
|
|
||||||
image.repart =
|
|
||||||
let
|
|
||||||
efiArch = pkgs.stdenv.hostPlatform.efiArch;
|
|
||||||
in
|
|
||||||
{
|
|
||||||
name = config.boot.uki.name;
|
|
||||||
# name = "image";
|
|
||||||
# split = true;
|
|
||||||
partitions = {
|
|
||||||
"esp" = {
|
|
||||||
# The contents to end up in the filesystem image.
|
|
||||||
contents = {
|
|
||||||
# "/EFI/BOOT/BOOTX64.EFI".source = "${pkgs.systemd}/lib/systemd/boot/efi/systemd-bootx64.efi";
|
|
||||||
"/EFI/BOOT/BOOT${lib.toUpper efiArch}.EFI".source =
|
|
||||||
"${pkgs.systemd}/lib/systemd/boot/efi/systemd-boot${efiArch}.efi";
|
|
||||||
|
|
||||||
"/EFI/Linux/${config.system.boot.loader.ukiFile}".source =
|
|
||||||
"${config.system.build.uki}/${config.system.boot.loader.ukiFile}";
|
|
||||||
|
|
||||||
# https://man.archlinux.org/man/loader.conf.5
|
|
||||||
"/loader/entries/loader.conf".source = pkgs.writeText "loader.conf" ''
|
|
||||||
timeout 0
|
|
||||||
editor yes
|
|
||||||
default *
|
|
||||||
logLevel=debug
|
|
||||||
'';
|
|
||||||
# "/loader/loader.conf".source = pkgs.writeText "loader.conf" ''
|
|
||||||
# timeout 0
|
|
||||||
# editor yes
|
|
||||||
# default *
|
|
||||||
# logLevel=debug
|
|
||||||
# '';
|
|
||||||
# nixos-*.conf
|
|
||||||
# "/loader/entries/nixos.conf".source = pkgs.writeText "nixos.conf" ''
|
|
||||||
# title NixOS
|
|
||||||
# linux /EFI/nixos/kernel.efi
|
|
||||||
# initrd /EFI/nixos/initrd.efi
|
|
||||||
# options init=/nix/store/.../init root=LABEL=nixos
|
|
||||||
# '';
|
|
||||||
|
|
||||||
# systemd-boot configuration
|
|
||||||
"/loader/loader.conf".source = (
|
|
||||||
pkgs.writeText "$out" ''
|
|
||||||
timeout 3
|
|
||||||
''
|
|
||||||
);
|
|
||||||
};
|
|
||||||
# https://www.man7.org/linux//man-pages/man5/repart.d.5.html
|
|
||||||
repartConfig = {
|
|
||||||
Priority = 1;
|
|
||||||
Type = "esp";
|
|
||||||
MountPoint = "/boot";
|
|
||||||
Format = "vfat";
|
|
||||||
UUID = "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa";
|
|
||||||
SizeMinBytes = "500M";
|
|
||||||
SizeMaxBytes = "500M";
|
|
||||||
};
|
|
||||||
# repartConfig = {
|
|
||||||
# Type = "esp";
|
|
||||||
# UUID = "c12a7328-f81f-11d2-ba4b-00a0c93ec93b"; # Well known
|
|
||||||
# Format = "vfat";
|
|
||||||
# SizeMinBytes = "256M";
|
|
||||||
# SplitName = "-";
|
|
||||||
# };
|
|
||||||
};
|
|
||||||
"root" = {
|
|
||||||
storePaths = [ config.system.build.toplevel ];
|
|
||||||
repartConfig = {
|
|
||||||
Priority = 2;
|
|
||||||
Type = "root";
|
|
||||||
Label = "nixos";
|
|
||||||
MountPoint = "/";
|
|
||||||
Format = "ext4";
|
|
||||||
UUID = "bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb";
|
|
||||||
# populates the fs twice
|
|
||||||
Minimize = "guess";
|
|
||||||
# Minimize = "off";
|
|
||||||
# SizeMinBytes = "1G";
|
|
||||||
# SizeMaxBytes = "20G";
|
|
||||||
};
|
|
||||||
|
|
||||||
# "store" = {
|
|
||||||
# storePaths = [ config.system.build.toplevel ];
|
|
||||||
# stripNixStorePrefix = true;
|
|
||||||
# repartConfig = {
|
|
||||||
# Type = "linux-generic";
|
|
||||||
# Label = "store_${config.system.image.version}";
|
|
||||||
# Format = "squashfs";
|
|
||||||
# Minimize = "off";
|
|
||||||
# ReadOnly = "yes";
|
|
||||||
|
|
||||||
# SizeMinBytes = "1G";
|
|
||||||
# SizeMaxBytes = "1G";
|
|
||||||
# SplitName = "store";
|
|
||||||
# };
|
|
||||||
# };
|
|
||||||
|
|
||||||
# # Placeholder for the second installed Nix store.
|
|
||||||
# "store-empty" = {
|
|
||||||
# repartConfig = {
|
|
||||||
# Type = "linux-generic";
|
|
||||||
# Label = "_empty";
|
|
||||||
# Minimize = "off";
|
|
||||||
# SizeMinBytes = "1G";
|
|
||||||
# SizeMaxBytes = "1G";
|
|
||||||
# SplitName = "-";
|
|
||||||
# };
|
|
||||||
# };
|
|
||||||
|
|
||||||
# # Persistent storage
|
|
||||||
# "var" = {
|
|
||||||
# repartConfig = {
|
|
||||||
# Type = "var";
|
|
||||||
# UUID = "4d21b016-b534-45c2-a9fb-5c16e091fd2d"; # Well known
|
|
||||||
# Format = "xfs";
|
|
||||||
# Label = "nixos-persistent";
|
|
||||||
# Minimize = "off";
|
|
||||||
|
|
||||||
# # Has to be large enough to hold update files.
|
|
||||||
# SizeMinBytes = "2G";
|
|
||||||
# SizeMaxBytes = "2G";
|
|
||||||
# SplitName = "-";
|
|
||||||
|
|
||||||
# # Wiping this gives us a clean state.
|
|
||||||
# FactoryReset = "yes";
|
|
||||||
# };
|
|
||||||
# };
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
@ -30,13 +30,13 @@
|
||||||
type = "gpt";
|
type = "gpt";
|
||||||
|
|
||||||
partitions = {
|
partitions = {
|
||||||
mbr = {
|
MBR = {
|
||||||
priority = 0;
|
priority = 0;
|
||||||
size = "1M";
|
size = "1M";
|
||||||
type = "EF02";
|
type = "EF02";
|
||||||
};
|
};
|
||||||
|
|
||||||
esp = {
|
ESP = {
|
||||||
priority = 1;
|
priority = 1;
|
||||||
size = "500M";
|
size = "500M";
|
||||||
type = "EF00";
|
type = "EF00";
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue