From a16b5dfe64929131984e79df9a1825f0413b1865 Mon Sep 17 00:00:00 2001 From: makefu Date: Tue, 11 Sep 2018 20:42:55 +0200 Subject: add README,stand-alone example --- README.md | 71 +++++++++++++++++++++++++++++++++++ example/stand-alone/configuration.nix | 17 +++++++++ example/stand-alone/tsp-disk.json | 22 +++++++++++ 3 files changed, 110 insertions(+) create mode 100644 README.md create mode 100644 example/stand-alone/configuration.nix create mode 100644 example/stand-alone/tsp-disk.json diff --git a/README.md b/README.md new file mode 100644 index 0000000..70058f1 --- /dev/null +++ b/README.md @@ -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 = [ + + ]; + 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/` diff --git a/example/stand-alone/configuration.nix b/example/stand-alone/configuration.nix new file mode 100644 index 0000000..2ee1597 --- /dev/null +++ b/example/stand-alone/configuration.nix @@ -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)) + ]; +} + diff --git a/example/stand-alone/tsp-disk.json b/example/stand-alone/tsp-disk.json new file mode 100644 index 0000000..1d82c13 --- /dev/null +++ b/example/stand-alone/tsp-disk.json @@ -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": "/" + } + } + ] + } + } +} + -- cgit v1.2.3