GithubHelp home page GithubHelp logo

disko's Introduction

disko

nix-powered automatic disk partitioning

Usage

Master Boot Record

This is how your iso configuation may look like

/etc/nixos/tsp-disk.json (TODO: find the correct disk)

{
  "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

{ 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.create 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 = ["[email protected]" ];
  #  serviceConfig = {
  #    Type = "oneshot";
  #    ExecStart = [ (disko.create cfg) (disk.mount cfg) ];
  #    StandardInput = "null";
  #    StandardOutput = "journal+console";
  #    StandardError = "inherit";
  #  };
  #};
}

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

GUID Partition Table, LVM and dm-crypt

See examples/

disko's People

Contributors

4z3 avatar lassulus avatar makefu avatar mic92 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.