add README,stand-alone example

This commit is contained in:
makefu 2018-09-11 20:42:55 +02:00
parent 88f56a0b64
commit a16b5dfe64
No known key found for this signature in database
GPG Key ID: 36F7711F3FC0F225
3 changed files with 110 additions and 0 deletions

71
README.md Normal file
View File

@ -0,0 +1,71 @@
disko
=====
nix-powered automatic disk partitioning
Usage
=====
Master Boot Record
------------------
This is how your iso configuation may look like
```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;[
(pkgs.writeScriptBin "tsp-create" (disko.mount cfg))
(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";
};
};
}
```
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": "/"
}
}
]
}
}
}
```
GUID Partition Table, LVM and dm-crypt
--------------------------------------
See `examples/`

View File

@ -0,0 +1,17 @@
{ pkgs, ... }:
let
disko = (builtins.fetchGit {
url = https://cgit.lassul.us/disko/;
rev = "88f56a0b644dd7bfa8438409bea5377adef6aef4";
}) + "/lib";
cfg = builtins.fromJSON ./tsp-disk.json;
in {
imports = [
(disko.config cfg)
];
environment.systemPackages = with pkgs;[
(pkgs.writeScriptBin "tsp-create" (disko.create cfg))
(pkgs.writeScriptBin "tsp-mount" (disko.mount cfg))
];
}

View File

@ -0,0 +1,22 @@
{
"type": "devices",
"content": {
"sda": {
"type": "table",
"format": "msdos",
"partitions": [
{ "type": "partition",
"start": "1M",
"end": "100%",
"bootable": true,
"content": {
"type": "filesystem",
"format": "ext4",
"mountpoint": "/"
}
}
]
}
}
}