summaryrefslogtreecommitdiffstats
path: root/example/stand-alone/configuration.nix
blob: 67576a044c8d7ea976cf250322aaa44a6bf407c7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
{
  pkgs,
  lib,
  ...
}: let
  # We just import from the repository for testing here:
  disko = import ../../. {
    inherit lib;
  };
  # In your own system use something like this:
  #import (builtins.fetchGit {
  #  url = "https://github.com/nix-community/disko";
  #  ref = "master";
  #}) {
  #  inherit lib;
  #};
  cfg = {
    disk = {
      sda = {
        device = "/dev/sda";
        type = "device";
        content = {
          type = "table";
          format = "msdos";
          partitions = [
            {
              name = "root";
              type = "partition";
              part-type = "primary";
              start = "1M";
              end = "100%";
              bootable = true;
              content = {
                type = "filesystem";
                format = "ext4";
                mountpoint = "/";
              };
            }
          ];
        };
      };
    };
  };
in {
  imports = [
    (disko.config cfg)
  ];
  boot.loader.grub.devices = [ "/dev/sda" ];
  system.stateVersion = "22.05";
  environment.systemPackages = with pkgs; [
    (pkgs.writeScriptBin "tsp-create" (disko.create cfg))
    (pkgs.writeScriptBin "tsp-mount" (disko.mount cfg))
  ];
}