mirror of
https://github.com/Stunkymonkey/nixos.git
synced 2025-05-24 09:54:40 +02:00
newton: use disko
This commit is contained in:
parent
2a713beab2
commit
4b389828ad
4 changed files with 81 additions and 31 deletions
|
@ -7,6 +7,7 @@ let
|
||||||
sops-nix
|
sops-nix
|
||||||
nixos-hardware
|
nixos-hardware
|
||||||
passworts
|
passworts
|
||||||
|
disko
|
||||||
;
|
;
|
||||||
nixosSystem = nixpkgs.lib.makeOverridable nixpkgs.lib.nixosSystem;
|
nixosSystem = nixpkgs.lib.makeOverridable nixpkgs.lib.nixosSystem;
|
||||||
overlay-unstable = final: prev: {
|
overlay-unstable = final: prev: {
|
||||||
|
@ -36,8 +37,9 @@ let
|
||||||
];
|
];
|
||||||
documentation.info.enable = false;
|
documentation.info.enable = false;
|
||||||
})
|
})
|
||||||
sops-nix.nixosModules.sops
|
disko.nixosModules.disko
|
||||||
passworts.nixosModules.passworts
|
passworts.nixosModules.passworts
|
||||||
|
sops-nix.nixosModules.sops
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
../modules
|
../modules
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
./boot.nix
|
./boot.nix
|
||||||
./disks.nix
|
|
||||||
./hardware-configuration.nix
|
./hardware-configuration.nix
|
||||||
./network.nix
|
./network.nix
|
||||||
./services.nix
|
./services.nix
|
||||||
|
@ -10,6 +9,10 @@
|
||||||
./system.nix
|
./system.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
|
disko.devices = import ./disko-config.nix {
|
||||||
|
disks = [ "/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_drive-scsi0" ];
|
||||||
|
};
|
||||||
|
|
||||||
networking.hostName = "newton";
|
networking.hostName = "newton";
|
||||||
|
|
||||||
sops = {
|
sops = {
|
||||||
|
|
74
machines/newton/disko-config.nix
Normal file
74
machines/newton/disko-config.nix
Normal file
|
@ -0,0 +1,74 @@
|
||||||
|
{ disks ? [ "/dev/sda" ], ... }:
|
||||||
|
{
|
||||||
|
disk = {
|
||||||
|
vdb = {
|
||||||
|
type = "disk";
|
||||||
|
device = builtins.head disks;
|
||||||
|
content = {
|
||||||
|
type = "gpt";
|
||||||
|
partitions = {
|
||||||
|
boot = {
|
||||||
|
size = "1M";
|
||||||
|
type = "EF02"; # for grub MBR
|
||||||
|
};
|
||||||
|
ESP = {
|
||||||
|
size = "512M";
|
||||||
|
type = "EF00";
|
||||||
|
content = {
|
||||||
|
type = "filesystem";
|
||||||
|
format = "vfat";
|
||||||
|
mountpoint = "/boot";
|
||||||
|
mountOptions = [
|
||||||
|
"defaults"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
luks = {
|
||||||
|
size = "100%";
|
||||||
|
content = {
|
||||||
|
type = "luks";
|
||||||
|
name = "encrypted";
|
||||||
|
extraOpenArgs = [ "--allow-discards" ];
|
||||||
|
passwordFile = "/tmp/disk.key";
|
||||||
|
content = {
|
||||||
|
type = "lvm_pv";
|
||||||
|
vg = "pool";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
lvm_vg = {
|
||||||
|
pool = {
|
||||||
|
type = "lvm_vg";
|
||||||
|
lvs = {
|
||||||
|
root = {
|
||||||
|
size = "100G";
|
||||||
|
content = {
|
||||||
|
type = "filesystem";
|
||||||
|
format = "ext4";
|
||||||
|
mountpoint = "/";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
srv = {
|
||||||
|
size = "350G";
|
||||||
|
content = {
|
||||||
|
type = "filesystem";
|
||||||
|
format = "ext4";
|
||||||
|
mountpoint = "/srv";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
swap = {
|
||||||
|
size = "4G";
|
||||||
|
content = {
|
||||||
|
type = "swap";
|
||||||
|
randomEncryption = true;
|
||||||
|
resumeDevice = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
|
@ -1,29 +0,0 @@
|
||||||
{ config, lib, pkgs, ... }:
|
|
||||||
|
|
||||||
{
|
|
||||||
boot.initrd.luks.devices."luks-drive" = {
|
|
||||||
name = "luks-drive";
|
|
||||||
device = "/dev/disk/by-partlabel/Crypt";
|
|
||||||
preLVM = true;
|
|
||||||
allowDiscards = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
fileSystems."/" = {
|
|
||||||
device = "/dev/disk/by-label/newton-root";
|
|
||||||
fsType = "ext4";
|
|
||||||
};
|
|
||||||
|
|
||||||
fileSystems."/boot" = {
|
|
||||||
device = "/dev/disk/by-label/newton-boot";
|
|
||||||
fsType = "vfat";
|
|
||||||
};
|
|
||||||
|
|
||||||
fileSystems."/srv" = {
|
|
||||||
device = "/dev/disk/by-label/newton-srv";
|
|
||||||
fsType = "ext4";
|
|
||||||
};
|
|
||||||
|
|
||||||
swapDevices = [{
|
|
||||||
device = "/dev/disk/by-label/newton-swap";
|
|
||||||
}];
|
|
||||||
}
|
|
Loading…
Add table
Add a link
Reference in a new issue