2019-08-27 22:41:09 +03:00
|
|
|
{ lib, newScope }:
|
|
|
|
|
2019-08-31 05:43:30 +03:00
|
|
|
let
|
|
|
|
inherit (lib) makeScope;
|
|
|
|
in
|
|
|
|
makeScope newScope (self:
|
2019-08-27 22:41:09 +03:00
|
|
|
let
|
|
|
|
inherit (self) callPackage;
|
|
|
|
in
|
2019-08-31 05:43:30 +03:00
|
|
|
# Note: Prefer using `self.something.deep` rather than making `something` a
|
|
|
|
# recursive set. Otherwise it won't override as expected.
|
2019-08-27 22:41:09 +03:00
|
|
|
{
|
2019-08-29 03:50:28 +03:00
|
|
|
makeFilesystem = callPackage ./makeFilesystem.nix {};
|
2019-08-27 22:41:09 +03:00
|
|
|
|
|
|
|
# All known supported filesystems for image generation.
|
|
|
|
# Use stand-alone (outside of a disk image) is supported.
|
2019-08-31 05:43:30 +03:00
|
|
|
fileSystem = {
|
2019-08-30 01:16:39 +03:00
|
|
|
makeExt4 = callPackage ./makeExt4.nix {};
|
2019-08-27 22:41:09 +03:00
|
|
|
makeFAT32 = callPackage ./makeFAT32.nix {};
|
|
|
|
# Specialization of `makeFAT32` with (1) filesystemType showing as ESP,
|
|
|
|
# and (2) the name defaults to ESP.
|
2019-08-31 05:43:30 +03:00
|
|
|
makeESP = args: self.fileSystem.makeFAT32 ({ name = "ESP"; filesystemType = "ESP"; } // args);
|
2019-08-27 22:41:09 +03:00
|
|
|
};
|
|
|
|
|
2019-09-05 07:38:46 +03:00
|
|
|
gap = length: {
|
|
|
|
inherit length;
|
|
|
|
isGap = true;
|
|
|
|
};
|
|
|
|
|
2019-08-27 22:41:09 +03:00
|
|
|
# All supported disk formats for image generation.
|
2019-08-31 05:43:30 +03:00
|
|
|
diskImage = {
|
2019-08-27 22:41:09 +03:00
|
|
|
makeMBR = callPackage ./makeMBR.nix {};
|
2019-09-21 20:57:12 +03:00
|
|
|
makeGPT = callPackage ./makeGPT.nix {};
|
2019-08-27 22:41:09 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
# Don't do maths yourselves, just use the helpers.
|
|
|
|
# Yes, this is the bibytes family of units.
|
2019-08-31 05:43:30 +03:00
|
|
|
# (This is fine as rec; it won't be overriden.)
|
2019-08-27 22:41:09 +03:00
|
|
|
size = rec {
|
|
|
|
TiB = x: 1024 * (GiB x);
|
|
|
|
GiB = x: 1024 * (MiB x);
|
|
|
|
MiB = x: 1024 * (KiB x);
|
|
|
|
KiB = x: 1024 * x;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
)
|