disko/example/stand-alone/configuration.nix

59 lines
1.3 KiB
Nix
Raw Normal View History

2022-09-04 13:09:10 +02:00
{
pkgs,
lib,
...
}: let
# We just import from the repository for testing here:
diskoNixos = import ../../. {
2022-08-19 09:47:39 +02:00
inherit lib;
};
2022-09-04 13:09:10 +02:00
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;
#};
2022-08-19 09:47:39 +02:00
cfg = {
2022-09-04 13:09:10 +02:00
disk = {
2022-08-19 09:47:39 +02:00
sda = {
2022-09-04 13:09:10 +02:00
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 = "/";
};
}
];
};
2022-08-19 09:47:39 +02:00
};
};
};
2018-09-11 20:42:55 +02:00
in {
imports = [
2022-09-04 13:09:10 +02:00
(diskoNixos.config cfg)
2018-09-11 20:42:55 +02:00
];
2022-09-04 13:09:10 +02:00
boot.loader.grub.devices = [ "/dev/sda" ];
system.stateVersion = "22.05";
environment.systemPackages = with pkgs; [
2018-09-11 20:42:55 +02:00
(pkgs.writeScriptBin "tsp-create" (disko.create cfg))
(pkgs.writeScriptBin "tsp-mount" (disko.mount cfg))
];
}