summaryrefslogtreecommitdiffstats
path: root/example/stand-alone/configuration.nix
blob: 600f6f92b2c8f4b4dc38bac1ce6273637990f99c (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
55
56
57
58
{
  pkgs,
  lib,
  ...
}: let
  # We just import from the repository for testing here:
  diskoNixos = import ../../. {
    inherit lib;
  };
  disko = import ../../. {
    inherit lib;
    inherit pkgs;
  };
  # 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 = [
    (diskoNixos.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))
  ];
}