disko/README.md

75 lines
1.8 KiB
Markdown
Raw Normal View History

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
/etc/nixos/configuration.nix
2018-09-11 21:42:55 +03:00
```nix
{ pkgs, modulesPath, ... }:
2018-09-11 21:42:55 +03:00
let
2022-08-17 16:28:24 +03:00
disko = pkgs.callPackage (builtins.fetchGit {
url = "https://github.com/nix-community/disko";
ref = "master";
}) {};
cfg = {
type = "devices";
content = {
sda = {
type = "table";
format = "msdos";
partitions = [{
type = "partition";
part-type = "primary";
start = "1M";
end = "100%";
bootable = true;
content = {
type = "filesystem";
format = "ext4";
mountpoint = "/";
};
}];
};
};
};
2018-09-11 21:42:55 +03:00
in {
imports = [
(modulesPath + "/installer/cd-dvd/installation-cd-minimal.nix")
2018-09-11 21:42:55 +03:00
];
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))
];
## 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
}
```
After `nixos-rebuild switch` this will add a `tsp-create` and a `tsp-mount`
command:
- **tsp-create**: creates & formats the partitions according to `tsp-disk.json`
- **tsp-mount**: mounts the partitions to `/mnt`
2018-09-11 21:42:55 +03:00
GUID Partition Table, LVM and dm-crypt
--------------------------------------
See `examples/`