everywhere-config/flake.nix
System administrator 9869100b8e Attempt boot fixes
2025-05-15 08:15:06 +00:00

82 lines
2.7 KiB
Nix

{
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
inputs.disko.url = "github:nix-community/disko";
inputs.disko.inputs.nixpkgs.follows = "nixpkgs";
inputs.nixos-facter-modules.url = "github:numtide/nixos-facter-modules";
outputs =
{
nixpkgs,
disko,
nixos-facter-modules,
...
}:
{
nixosConfigurations.hetzner-cloud = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
disko.nixosModules.disko
./configuration.nix
];
};
# tested with 2GB/2CPU droplet, 1GB droplets do not have enough RAM for kexec
nixosConfigurations.digitalocean = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
disko.nixosModules.disko
{ disko.devices.disk.disk1.device = "/dev/vda"; }
{
# do not use DHCP, as DigitalOcean provisions IPs using cloud-init
networking.useDHCP = nixpkgs.lib.mkForce false;
services.cloud-init = {
enable = true;
network.enable = true;
settings = {
datasource_list = [ "ConfigDrive" ];
datasource.ConfigDrive = { };
};
};
}
./configuration.nix
];
};
nixosConfigurations.hetzner-cloud-aarch64 = nixpkgs.lib.nixosSystem {
system = "aarch64-linux";
modules = [
disko.nixosModules.disko
./configuration.nix
];
};
# Use this for all other targets
# nixos-anywhere --flake .#generic --generate-hardware-config nixos-generate-config ./hardware-configuration.nix <hostname>
nixosConfigurations.generic = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
disko.nixosModules.disko
./configuration.nix
nixos-facter-modules.nixosModules.facter
{ config.facter.reportPath = ./facter.json; }
];
};
# Slightly experimental: Like generic, but with nixos-facter (https://github.com/numtide/nixos-facter)
# nixos-anywhere --flake .#generic-nixos-facter --generate-hardware-config nixos-facter facter.json <hostname>
nixosConfigurations.generic-nixos-facter = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
disko.nixosModules.disko
./configuration.nix
nixos-facter-modules.nixosModules.facter
{
config.facter.reportPath =
if builtins.pathExists ./facter.json then
./facter.json
else
throw "Have you forgotten to run nixos-anywhere with `--generate-hardware-config nixos-facter ./facter.json`?";
}
];
};
};
}