nixos-anywhere | cleanup and update
This commit is contained in:
parent
57a4119ff4
commit
649c74ce60
8 changed files with 117 additions and 347 deletions
|
|
@ -1,46 +0,0 @@
|
|||
{ modulesPath, config, lib, pkgs, ... }: {
|
||||
imports = [
|
||||
(modulesPath + "/installer/scan/not-detected.nix")
|
||||
(modulesPath + "/profiles/qemu-guest.nix")
|
||||
./disk-config-vm.nix
|
||||
];
|
||||
boot = {
|
||||
kernelPackages = pkgs.linuxPackages_latest;
|
||||
kernelParams = [ "consoleblank=60" ];
|
||||
loader = {
|
||||
timeout = 10;
|
||||
/* systemd-boot = {
|
||||
enable = true;
|
||||
};
|
||||
*/
|
||||
grub = {
|
||||
device = "nodev";
|
||||
efiSupport = true;
|
||||
efiInstallAsRemovable = true;
|
||||
forceInstall = true;
|
||||
};
|
||||
efi = {
|
||||
#canTouchEfiVariables = true;
|
||||
efiSysMountPoint = "/boot";
|
||||
};
|
||||
};
|
||||
plymouth = {
|
||||
enable = true;
|
||||
theme = "breeze";
|
||||
};
|
||||
kernel = { sysctl = { "vm.swappiness" = 10; }; };
|
||||
};
|
||||
services.openssh.enable = true;
|
||||
|
||||
environment.systemPackages =
|
||||
map lib.lowPrio [ pkgs.curl pkgs.git pkgs.git-crypt ];
|
||||
|
||||
users.users.root = {
|
||||
initialPassword = "changeme";
|
||||
openssh.authorizedKeys.keys = [
|
||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINd8AdVbQQ/Fmw+b9mI8EMYqIoRkwmSwAOtmlte3incL don@loki"
|
||||
];
|
||||
};
|
||||
|
||||
system.stateVersion = "24.11";
|
||||
}
|
||||
|
|
@ -1,57 +0,0 @@
|
|||
{ modulesPath, config, lib, pkgs, ... }: {
|
||||
imports = [
|
||||
(modulesPath + "/installer/scan/not-detected.nix")
|
||||
(modulesPath + "/profiles/qemu-guest.nix")
|
||||
./disk-config-vps.nix
|
||||
];
|
||||
boot = {
|
||||
kernelPackages = pkgs.linuxPackages_latest;
|
||||
kernelParams = [ "consoleblank=60" ];
|
||||
loader = {
|
||||
timeout = 10;
|
||||
/* systemd-boot = {
|
||||
enable = true;
|
||||
};
|
||||
*/
|
||||
grub = {
|
||||
device = "nodev";
|
||||
efiSupport = true;
|
||||
efiInstallAsRemovable = true;
|
||||
forceInstall = true;
|
||||
};
|
||||
efi = {
|
||||
#canTouchEfiVariables = true;
|
||||
efiSysMountPoint = "/boot";
|
||||
};
|
||||
};
|
||||
plymouth = {
|
||||
enable = true;
|
||||
theme = "breeze";
|
||||
};
|
||||
kernel = { sysctl = { "vm.swappiness" = 10; }; };
|
||||
};
|
||||
|
||||
# Enable networking
|
||||
networking.networkmanager.enable = true;
|
||||
networking.enableIPv6 = true;
|
||||
networking.useDHCP = false;
|
||||
services.openssh.enable = true;
|
||||
|
||||
# Set your time zone.
|
||||
time = {
|
||||
timeZone = "America/Chicago";
|
||||
hardwareClockInLocalTime = false;
|
||||
};
|
||||
|
||||
environment.systemPackages =
|
||||
map lib.lowPrio [ pkgs.curl pkgs.git pkgs.git-crypt ];
|
||||
|
||||
users.users.root = {
|
||||
initialPassword = "changeme";
|
||||
openssh.authorizedKeys.keys = [
|
||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINd8AdVbQQ/Fmw+b9mI8EMYqIoRkwmSwAOtmlte3incL don@loki"
|
||||
];
|
||||
};
|
||||
|
||||
system.stateVersion = "24.11";
|
||||
}
|
||||
|
|
@ -1,57 +1,47 @@
|
|||
{ modulesPath, config, lib, pkgs, ... }: {
|
||||
{
|
||||
modulesPath,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
} @ args: {
|
||||
imports = [
|
||||
(modulesPath + "/installer/scan/not-detected.nix")
|
||||
(modulesPath + "/profiles/qemu-guest.nix")
|
||||
./disk-config.nix
|
||||
];
|
||||
disko.devices.disk.main.device = "/dev/sda";
|
||||
boot = {
|
||||
kernelPackages = pkgs.linuxPackages_zen;
|
||||
kernelParams = [ "consoleblank=60" ];
|
||||
# extraModulePackages = [config.boot.kernelPackages.ddcci-driver];
|
||||
# kernelModules = ["i2c-dev" "ddcci_backlight"];
|
||||
loader = if (pkgs.hostPlatform != lib.mkDefault "aarch64-linux") then {
|
||||
systemd-boot = { enable = true; };
|
||||
efi = {
|
||||
canTouchEfiVariables = true;
|
||||
efiSysMountPoint = "/boot";
|
||||
};
|
||||
} else {
|
||||
grub.enable = false;
|
||||
generic-extlinux-compatible.enable = true;
|
||||
};
|
||||
plymouth = {
|
||||
enable = true;
|
||||
theme = "breeze";
|
||||
};
|
||||
kernel = { sysctl = { "vm.swappiness" = 10; }; };
|
||||
boot.kernelParams = ["consoleblank=60"];
|
||||
boot.plymouth = {
|
||||
enable = true;
|
||||
theme = "breeze";
|
||||
};
|
||||
boot.loader.grub = {
|
||||
efiSupport = true;
|
||||
efiInstallAsRemovable = true;
|
||||
};
|
||||
|
||||
# Enable networking
|
||||
networking.networkmanager.enable = true;
|
||||
networking.enableIPv6 = true;
|
||||
networking.useDHCP = false;
|
||||
services.openssh.enable = true;
|
||||
|
||||
# Set your time zone.
|
||||
time = {
|
||||
timeZone = "America/Chicago";
|
||||
hardwareClockInLocalTime = false;
|
||||
};
|
||||
|
||||
environment.systemPackages =
|
||||
map lib.lowPrio [ pkgs.curl pkgs.git pkgs.git-crypt ];
|
||||
environment.systemPackages = map lib.lowPrio [
|
||||
pkgs.curl
|
||||
pkgs.git
|
||||
pkgs.git-crypt
|
||||
pkgs.sops
|
||||
pkgs.age
|
||||
];
|
||||
|
||||
users.users.root = {
|
||||
initialPassword = "changeme";
|
||||
openssh.authorizedKeys.keys = [
|
||||
users.users.root.openssh.authorizedKeys.keys =
|
||||
[
|
||||
"ssh-dss AAAAB3NzaC1kc3MAAACBAL/6Wxt6Rr9agFaw41WYMU6IoF3X1bpdrFSUJg+CgaIXEnHFZJgNhcGfoGMp9H1ikOy/yN5GDqsEuiDYlWu3Dild0Q8k1cDMiL4m/xUwLDgFByPBYZ2FlAikogFXm5cMLneD7jP82FZKa8YpTzm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gwGIasGWvqKBLTZte5IY95/9FtCcloHYpTRmQnfoIly9ShetA6wsierhMu36G/GmD4813neo62Qh0wZq87/CwNjBW8A6E+J8R+oXBsdjaVT4SNqJZgpuuRit9Jp75Mb3Vmh/wnuD+AtLH7Kmu2kYA+xMvNYvLGEeObb6+HiUheCJhGxW+YRBh9COuxp6+77sitIZovROMimkdJimZ/grWCPSfz0PYbNfuWmu6udmAQOarZ7lhX2b0y/T3I+LP3yoxfAwTFyjjyxJuPRF2grDDEug9pG3EnJLUDAuXh5hSrf1TVg12KQ346+/gllJyQ92HW+0KW/jQV5PsGy6O4ySYSRRaSBkAzjxfDzByzSYDyqhAaINyVwRfKWscIxw== don@dragon"
|
||||
];
|
||||
};
|
||||
]
|
||||
++ (args.extraPublicKeys or []); # this is used for unit-testing this module and can be removed if not needed
|
||||
|
||||
system.stateVersion = "24.11";
|
||||
system.stateVersion = "25.11";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,53 +0,0 @@
|
|||
# Example to create a bios compatible gpt partition
|
||||
{ lib, ... }: {
|
||||
disko.devices = {
|
||||
disk.disk1 = {
|
||||
device = lib.mkDefault "/dev/mmcblk0";
|
||||
type = "disk";
|
||||
content = {
|
||||
type = "gpt";
|
||||
partitions = {
|
||||
boot = {
|
||||
name = "boot";
|
||||
size = "1M";
|
||||
type = "EF02";
|
||||
};
|
||||
esp = {
|
||||
name = "ESP";
|
||||
size = "500M";
|
||||
type = "EF00";
|
||||
content = {
|
||||
type = "filesystem";
|
||||
format = "vfat";
|
||||
mountpoint = "/boot";
|
||||
};
|
||||
};
|
||||
root = {
|
||||
name = "root";
|
||||
size = "100%";
|
||||
content = {
|
||||
type = "lvm_pv";
|
||||
vg = "pool";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
lvm_vg = {
|
||||
pool = {
|
||||
type = "lvm_vg";
|
||||
lvs = {
|
||||
root = {
|
||||
size = "100%FREE";
|
||||
content = {
|
||||
type = "filesystem";
|
||||
format = "ext4";
|
||||
mountpoint = "/";
|
||||
mountOptions = [ "defaults" ];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -1,53 +0,0 @@
|
|||
# Example to create a bios compatible gpt partition
|
||||
{ lib, ... }: {
|
||||
disko.devices = {
|
||||
disk.disk1 = {
|
||||
device = lib.mkDefault "/dev/vda";
|
||||
type = "disk";
|
||||
content = {
|
||||
type = "gpt";
|
||||
partitions = {
|
||||
boot = {
|
||||
name = "boot";
|
||||
size = "1M";
|
||||
type = "EF02";
|
||||
};
|
||||
esp = {
|
||||
name = "ESP";
|
||||
size = "500M";
|
||||
type = "EF00";
|
||||
content = {
|
||||
type = "filesystem";
|
||||
format = "vfat";
|
||||
mountpoint = "/boot";
|
||||
};
|
||||
};
|
||||
root = {
|
||||
name = "root";
|
||||
size = "100%";
|
||||
content = {
|
||||
type = "lvm_pv";
|
||||
vg = "pool";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
lvm_vg = {
|
||||
pool = {
|
||||
type = "lvm_vg";
|
||||
lvs = {
|
||||
root = {
|
||||
size = "100%FREE";
|
||||
content = {
|
||||
type = "filesystem";
|
||||
format = "ext4";
|
||||
mountpoint = "/";
|
||||
mountOptions = [ "defaults" ];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -1,53 +0,0 @@
|
|||
# Example to create a bios compatible gpt partition
|
||||
{ lib, ... }: {
|
||||
disko.devices = {
|
||||
disk.disk1 = {
|
||||
device = lib.mkDefault "/dev/sda";
|
||||
type = "disk";
|
||||
content = {
|
||||
type = "gpt";
|
||||
partitions = {
|
||||
boot = {
|
||||
name = "boot";
|
||||
size = "1M";
|
||||
type = "EF02";
|
||||
};
|
||||
esp = {
|
||||
name = "ESP";
|
||||
size = "500M";
|
||||
type = "EF00";
|
||||
content = {
|
||||
type = "filesystem";
|
||||
format = "vfat";
|
||||
mountpoint = "/boot";
|
||||
};
|
||||
};
|
||||
root = {
|
||||
name = "root";
|
||||
size = "100%";
|
||||
content = {
|
||||
type = "lvm_pv";
|
||||
vg = "pool";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
lvm_vg = {
|
||||
pool = {
|
||||
type = "lvm_vg";
|
||||
lvs = {
|
||||
root = {
|
||||
size = "100%FREE";
|
||||
content = {
|
||||
type = "filesystem";
|
||||
format = "ext4";
|
||||
mountpoint = "/";
|
||||
mountOptions = [ "defaults" ];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -2,37 +2,38 @@
|
|||
# Update devices to match your hardware.
|
||||
# {
|
||||
# imports = [ ./disko-config.nix ];
|
||||
# disko.devices.disk.main.device = "/dev/sda";
|
||||
# disko.devices.disk1.main.device = "/dev/sda";
|
||||
# }
|
||||
{
|
||||
{lib, ...}: {
|
||||
disko.devices = {
|
||||
disk = {
|
||||
main = {
|
||||
type = "disk";
|
||||
content = {
|
||||
type = "gpt";
|
||||
partitions = {
|
||||
boot = {
|
||||
size = "1M";
|
||||
type = "EF02"; # for grub MBR
|
||||
disk.disk1 = {
|
||||
device = lib.mkDefault "/dev/sda";
|
||||
type = "disk";
|
||||
content = {
|
||||
type = "gpt";
|
||||
partitions = {
|
||||
boot = {
|
||||
name = "boot";
|
||||
size = "1M";
|
||||
type = "EF02";
|
||||
};
|
||||
esp = {
|
||||
name = "ESP";
|
||||
size = "500M";
|
||||
type = "EF00";
|
||||
content = {
|
||||
type = "filesystem";
|
||||
format = "vfat";
|
||||
mountpoint = "/boot";
|
||||
};
|
||||
ESP = {
|
||||
size = "1G";
|
||||
type = "EF00";
|
||||
content = {
|
||||
type = "filesystem";
|
||||
format = "vfat";
|
||||
mountpoint = "/boot";
|
||||
mountOptions = [ "umask=0077" ];
|
||||
};
|
||||
};
|
||||
root = {
|
||||
size = "100%";
|
||||
content = {
|
||||
type = "filesystem";
|
||||
format = "ext4";
|
||||
mountpoint = "/";
|
||||
};
|
||||
};
|
||||
root = {
|
||||
name = "root";
|
||||
size = "100%";
|
||||
content = {
|
||||
type = "filesystem";
|
||||
format = "ext4";
|
||||
mountpoint = "/";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -2,27 +2,68 @@
|
|||
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, ... }: {
|
||||
nixosConfigurations.fred = nixpkgs.lib.nixosSystem {
|
||||
stdenv.hostPlatform.system = "x86_64-linux";
|
||||
modules = [ disko.nixosModules.disko ./configuration.nix ];
|
||||
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 = [
|
||||
./digitalocean.nix
|
||||
disko.nixosModules.disko
|
||||
{ disko.devices.disk.disk1.device = "/dev/vda"; }
|
||||
./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
|
||||
./hardware-configuration.nix
|
||||
];
|
||||
};
|
||||
|
||||
# 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`?";
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
nixosConfigurations.book = nixpkgs.lib.nixosSystem {
|
||||
stdenv.hostPlatform.system = "x86_64-linux";
|
||||
modules = [ disko.nixosModules.disko ./configuration.nix ];
|
||||
};
|
||||
nixosConfigurations.t2 = nixpkgs.lib.nixosSystem {
|
||||
stdenv.hostPlatform.system = "aarch64-linux";
|
||||
modules = [ disko.nixosModules.disko ./configuration.nix ];
|
||||
};
|
||||
nixosConfigurations.vm = nixpkgs.lib.nixosSystem {
|
||||
stdenv.hostPlatform.system = "x86_64-linux";
|
||||
modules = [ disko.nixosModules.disko ./configuration-vm.nix ];
|
||||
};
|
||||
nixosConfigurations.w2 = nixpkgs.lib.nixosSystem {
|
||||
stdenv.hostPlatform.system = "x86_64-linux";
|
||||
modules = [ disko.nixosModules.disko ./configuration-vps.nix ];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue