2018-09-11 21:42:55 +03:00
|
|
|
disko
|
|
|
|
=====
|
|
|
|
|
|
|
|
nix-powered automatic disk partitioning
|
|
|
|
|
|
|
|
Usage
|
|
|
|
=====
|
|
|
|
|
|
|
|
Master Boot Record
|
|
|
|
------------------
|
|
|
|
This is how your iso configuation may look like
|
|
|
|
|
2019-09-16 12:52:23 +03:00
|
|
|
/etc/nixos/tsp-disk.json (TODO: find the correct disk)
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"type": "devices",
|
|
|
|
"content": {
|
|
|
|
"sda": {
|
|
|
|
"type": "table",
|
|
|
|
"format": "msdos",
|
|
|
|
"partitions": [{
|
|
|
|
"type": "partition",
|
|
|
|
"start": "1M",
|
|
|
|
"end": "100%",
|
|
|
|
"bootable": true,
|
|
|
|
"content": {
|
|
|
|
"type": "filesystem",
|
|
|
|
"format": "ext4",
|
|
|
|
"mountpoint": "/"
|
|
|
|
}
|
|
|
|
}]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
/etc/nixos/configuration.nix
|
2018-09-11 21:42:55 +03:00
|
|
|
```nix
|
|
|
|
{ pkgs, ... }:
|
|
|
|
let
|
|
|
|
disko = (builtins.fetchGit {
|
|
|
|
url = https://cgit.lassul.us/disko/;
|
|
|
|
rev = "88f56a0b644dd7bfa8438409bea5377adef6aef4";
|
|
|
|
}) + "/lib";
|
|
|
|
cfg = builtins.fromJSON ./tsp-disk.json;
|
|
|
|
in {
|
|
|
|
imports = [
|
|
|
|
<nixpkgs/nixos/modules/installer/cd-dvd/installation-cd-minimal.nix>
|
|
|
|
];
|
|
|
|
environment.systemPackages = with pkgs;[
|
2019-09-16 12:56:41 +03:00
|
|
|
(pkgs.writeScriptBin "tsp-create" (disko.create cfg))
|
2018-09-11 21:42:55 +03:00
|
|
|
(pkgs.writeScriptBin "tsp-mount" (disko.mount cfg))
|
|
|
|
];
|
2019-09-16 12:51:13 +03:00
|
|
|
## Optional: Automatically creates a service which runs at startup to perform the partitioning
|
|
|
|
#systemd.services.install-to-hd = {
|
|
|
|
# enable = true;
|
|
|
|
# wantedBy = ["multi-user.target"];
|
|
|
|
# after = ["getty@tty1.service" ];
|
|
|
|
# serviceConfig = {
|
|
|
|
# Type = "oneshot";
|
|
|
|
# ExecStart = [ (disko.create cfg) (disk.mount cfg) ];
|
|
|
|
# StandardInput = "null";
|
|
|
|
# StandardOutput = "journal+console";
|
|
|
|
# StandardError = "inherit";
|
|
|
|
# };
|
|
|
|
#};
|
2018-09-11 21:42:55 +03:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
GUID Partition Table, LVM and dm-crypt
|
|
|
|
--------------------------------------
|
|
|
|
See `examples/`
|