Skip to content

Commit

Permalink
Fix disko setup: device override & partition layout (#52)
Browse files Browse the repository at this point in the history
  • Loading branch information
pdalpra authored Oct 16, 2023
1 parent 302aaf4 commit 8aec671
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
6 changes: 4 additions & 2 deletions lib/mk-nixos.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ let
nix.registry.nixpkgs.flake = nixpkgs;
};
machineRoot = ../system/machines + "/${name}";
specificConfig = machineRoot + /configuration.nix;
diskoConfig = import (machineRoot + /disks.nix) { };
in
nixpkgs.lib.nixosSystem {
inherit system specialArgs;
Expand All @@ -20,7 +22,7 @@ nixpkgs.lib.nixosSystem {
disko.nixosModules.disko
./cachix.nix
../system/configuration.nix
(machineRoot + /configuration.nix)
(machineRoot + /disks.nix)
specificConfig
diskoConfig
];
}
18 changes: 9 additions & 9 deletions system/machines/vm/disks.nix
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
{ disks ? [ "/dev/sda" ], ... }:
let
mainDisk = builtins.elemAt disks 0;
in
{
disko.devices = {
disk.sda = {
device = "/dev/sda";
disk.main = {
device = mainDisk;
type = "disk";
content = {
type = "gpt";
partitions = {
ESP = {
name = "ESP";
device = "/dev/disk/by-label/boot";
end = "512M";
type = "EF00";
size = "512M";
content = {
type = "filesystem";
format = "vfat";
Expand All @@ -18,18 +22,14 @@
};
root = {
name = "root";
device = "/dev/disk/by-label/nixos";
start = "512M";
end = "-10G";
end = "-2G";
content = {
type = "filesystem";
format = "ext4";
mountpoint = "/";
};
};
swap = {
name = "swap";
device = "/dev/disk/by-label/swap";
size = "100%";
content = {
type = "swap";
Expand Down

0 comments on commit 8aec671

Please sign in to comment.