mirror of
https://github.com/nix-community/disko.git
synced 2026-11-30 21:13:28 +01:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9f29cedac7 | ||
|
|
56e6cad143 | ||
|
|
10fb975003 | ||
|
|
999f80f315 | ||
|
|
7548ad9469 | ||
|
|
9ab96378f8 | ||
|
|
1be23d771f | ||
|
|
4ec801c317 | ||
|
|
ea3e29fe7d | ||
|
|
0faae8adf6 | ||
|
|
8aa6ec5ff2 |
No files matched your search
+1
-1
@@ -22,7 +22,7 @@ requirements. If you're not sure which layout to pick, use the
|
|||||||
[hybrid](https://github.com/nix-community/disko/blob/master/example/hybrid.nix)
|
[hybrid](https://github.com/nix-community/disko/blob/master/example/hybrid.nix)
|
||||||
configuration. This layout is compatible with both BIOS and EFI systems.
|
configuration. This layout is compatible with both BIOS and EFI systems.
|
||||||
|
|
||||||
Refer to the [reference manual](./reference) for more information about the
|
Refer to the [reference manual](./reference.md) for more information about the
|
||||||
sample layouts and how to build your own configuration.
|
sample layouts and how to build your own configuration.
|
||||||
|
|
||||||
Once you've chosen your layout, you'll need to make a note of the URL to the raw
|
Once you've chosen your layout, you'll need to make a note of the URL to the raw
|
||||||
|
|||||||
Generated
+3
-3
@@ -2,11 +2,11 @@
|
|||||||
"nodes": {
|
"nodes": {
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1694593561,
|
"lastModified": 1694948089,
|
||||||
"narHash": "sha256-WSaIQZ5s9N9bDFkEMTw6P9eaZ9bv39ZhsiW12GtTNM0=",
|
"narHash": "sha256-d2B282GmQ9o8klc22/Rbbbj6r99EnELQpOQjWMyv0rU=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "1697b7d480449b01111e352021f46e5879e47643",
|
"rev": "5148520bfab61f99fd25fb9ff7bfbb50dad3c9db",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|||||||
+6
-6
@@ -11,10 +11,10 @@ let
|
|||||||
diskoLib = {
|
diskoLib = {
|
||||||
|
|
||||||
# like make-disk-image.nix from nixpkgs, but with disko config
|
# like make-disk-image.nix from nixpkgs, but with disko config
|
||||||
makeDiskImage = args: (import ./make-disk-image.nix ({ inherit diskoLib; } // args)).pure;
|
makeDiskImages = args: (import ./make-disk-image.nix ({ inherit diskoLib; } // args)).pure;
|
||||||
|
|
||||||
# a version of makeDiskImage which runs outside of the store
|
# a version of makeDiskImage which runs outside of the store
|
||||||
makeDiskImageScript = args: (import ./make-disk-image.nix ({ inherit diskoLib; } // args)).impure;
|
makeDiskImagesScript = args: (import ./make-disk-image.nix ({ inherit diskoLib; } // args)).impure;
|
||||||
|
|
||||||
testLib = import ./tests.nix { inherit lib makeTest eval-config; };
|
testLib = import ./tests.nix { inherit lib makeTest eval-config; };
|
||||||
# like lib.types.oneOf but instead of a list takes an attrset
|
# like lib.types.oneOf but instead of a list takes an attrset
|
||||||
@@ -24,7 +24,7 @@ let
|
|||||||
description = "one of ${concatStringsSep "," (attrNames types)}";
|
description = "one of ${concatStringsSep "," (attrNames types)}";
|
||||||
check = x: if x ? type then types.${x.type}.check x else throw "No type option set in:\n${generators.toPretty {} x}";
|
check = x: if x ? type then types.${x.type}.check x else throw "No type option set in:\n${generators.toPretty {} x}";
|
||||||
merge = loc: foldl'
|
merge = loc: foldl'
|
||||||
(res: def: types.${def.value.type}.merge loc [
|
(_res: def: types.${def.value.type}.merge loc [
|
||||||
# we add a dummy root parent node to render documentation
|
# we add a dummy root parent node to render documentation
|
||||||
(lib.recursiveUpdate { value._module.args = extraArgs; } def)
|
(lib.recursiveUpdate { value._module.args = extraArgs; } def)
|
||||||
])
|
])
|
||||||
@@ -183,7 +183,7 @@ let
|
|||||||
/* Takes a Submodules config and options argument and returns a serializable
|
/* Takes a Submodules config and options argument and returns a serializable
|
||||||
subset of config variables as a shell script snippet.
|
subset of config variables as a shell script snippet.
|
||||||
*/
|
*/
|
||||||
defineHookVariables = { config, options }:
|
defineHookVariables = { options }:
|
||||||
let
|
let
|
||||||
sanitizeName = lib.replaceStrings [ "-" ] [ "_" ];
|
sanitizeName = lib.replaceStrings [ "-" ] [ "_" ];
|
||||||
isAttrsOfSubmodule = o: o.type.name == "attrsOf" && o.type.nestedTypes.elemType.name == "submodule";
|
isAttrsOfSubmodule = o: o.type.name == "attrsOf" && o.type.nestedTypes.elemType.name == "submodule";
|
||||||
@@ -229,7 +229,7 @@ let
|
|||||||
type = lib.types.str;
|
type = lib.types.str;
|
||||||
default = ''
|
default = ''
|
||||||
( # ${config.type} ${concatMapStringsSep " " (n: toString (config.${n} or "")) ["name" "device" "format" "mountpoint"]} #
|
( # ${config.type} ${concatMapStringsSep " " (n: toString (config.${n} or "")) ["name" "device" "format" "mountpoint"]} #
|
||||||
${diskoLib.indent (diskoLib.defineHookVariables { inherit config options; })}
|
${diskoLib.indent (diskoLib.defineHookVariables { inherit options; })}
|
||||||
${config.preCreateHook}
|
${config.preCreateHook}
|
||||||
${diskoLib.indent attrs.default}
|
${diskoLib.indent attrs.default}
|
||||||
${config.postCreateHook}
|
${config.postCreateHook}
|
||||||
@@ -238,7 +238,7 @@ let
|
|||||||
description = "Creation script";
|
description = "Creation script";
|
||||||
};
|
};
|
||||||
|
|
||||||
mkMountOption = { config, options, default }@attrs:
|
mkMountOption = { default, ... }@attrs:
|
||||||
lib.mkOption {
|
lib.mkOption {
|
||||||
internal = true;
|
internal = true;
|
||||||
readOnly = true;
|
readOnly = true;
|
||||||
|
|||||||
+1
-1
@@ -19,7 +19,7 @@
|
|||||||
imageSize = lib.mkOption {
|
imageSize = lib.mkOption {
|
||||||
type = lib.types.strMatching "[0-9]+[KMGTP]?";
|
type = lib.types.strMatching "[0-9]+[KMGTP]?";
|
||||||
description = ''
|
description = ''
|
||||||
size of the image if the makeDiskImage function from diksoLib is used.
|
size of the image if the makeDiskImages function from diksoLib is used.
|
||||||
is used as an argument to truncate -s
|
is used as an argument to truncate -s
|
||||||
'';
|
'';
|
||||||
default = "2G";
|
default = "2G";
|
||||||
|
|||||||
+1
-1
@@ -107,7 +107,7 @@ in
|
|||||||
--typecode=${toString partition._index}:${partition.type} \
|
--typecode=${toString partition._index}:${partition.type} \
|
||||||
${config.device}
|
${config.device}
|
||||||
# ensure /dev/disk/by-path/..-partN exists before continuing
|
# ensure /dev/disk/by-path/..-partN exists before continuing
|
||||||
partprobe
|
partprobe ${config.device}
|
||||||
udevadm trigger --subsystem-match=block
|
udevadm trigger --subsystem-match=block
|
||||||
udevadm settle
|
udevadm settle
|
||||||
${lib.optionalString (partition.content != null) partition.content._create}
|
${lib.optionalString (partition.content != null) partition.content._create}
|
||||||
|
|||||||
+1
-1
@@ -114,7 +114,7 @@ in
|
|||||||
{
|
{
|
||||||
dev = ''
|
dev = ''
|
||||||
cryptsetup status ${config.name} >/dev/null 2>/dev/null ||
|
cryptsetup status ${config.name} >/dev/null 2>/dev/null ||
|
||||||
cryptsetup luksOpen ${config.device} ${config.name} \
|
cryptsetup open ${config.device} ${config.name} \
|
||||||
${keyFileArgs}
|
${keyFileArgs}
|
||||||
${lib.optionalString (config.content != null) contentMount.dev or ""}
|
${lib.optionalString (config.content != null) contentMount.dev or ""}
|
||||||
'';
|
'';
|
||||||
|
|||||||
+1
-1
@@ -42,7 +42,7 @@
|
|||||||
--force \
|
--force \
|
||||||
--homehost=any \
|
--homehost=any \
|
||||||
"''${disk_devices[@]}"
|
"''${disk_devices[@]}"
|
||||||
partprobe
|
partprobe /dev/md/${config.name}
|
||||||
udevadm trigger --subsystem-match=block
|
udevadm trigger --subsystem-match=block
|
||||||
udevadm settle
|
udevadm settle
|
||||||
# for some reason mdadm devices spawn with an existing partition table, so we need to wipe it
|
# for some reason mdadm devices spawn with an existing partition table, so we need to wipe it
|
||||||
|
|||||||
+2
-2
@@ -91,7 +91,7 @@
|
|||||||
parted -s ${config.device} -- mkpart ${partition.part-type} ${diskoLib.maybeStr partition.fs-type} ${partition.start} ${partition.end}
|
parted -s ${config.device} -- mkpart ${partition.part-type} ${diskoLib.maybeStr partition.fs-type} ${partition.start} ${partition.end}
|
||||||
''}
|
''}
|
||||||
# ensure /dev/disk/by-path/..-partN exists before continuing
|
# ensure /dev/disk/by-path/..-partN exists before continuing
|
||||||
partprobe
|
partprobe ${config.device}
|
||||||
udevadm trigger --subsystem-match=block
|
udevadm trigger --subsystem-match=block
|
||||||
udevadm settle
|
udevadm settle
|
||||||
${lib.optionalString partition.bootable ''
|
${lib.optionalString partition.bootable ''
|
||||||
@@ -101,7 +101,7 @@
|
|||||||
parted -s ${config.device} -- set ${toString partition._index} ${flag} on
|
parted -s ${config.device} -- set ${toString partition._index} ${flag} on
|
||||||
'') partition.flags}
|
'') partition.flags}
|
||||||
# ensure further operations can detect new partitions
|
# ensure further operations can detect new partitions
|
||||||
partprobe
|
partprobe ${config.device}
|
||||||
udevadm trigger --subsystem-match=block
|
udevadm trigger --subsystem-match=block
|
||||||
udevadm settle
|
udevadm settle
|
||||||
${lib.optionalString (partition.content != null) partition.content._create}
|
${lib.optionalString (partition.content != null) partition.content._create}
|
||||||
|
|||||||
@@ -50,7 +50,7 @@
|
|||||||
zfs create ${config._parent.name}/${config.name} \
|
zfs create ${config._parent.name}/${config.name} \
|
||||||
${lib.concatStringsSep " " (lib.mapAttrsToList (n: v: "-o ${n}=${v}") config.options)} \
|
${lib.concatStringsSep " " (lib.mapAttrsToList (n: v: "-o ${n}=${v}") config.options)} \
|
||||||
-V ${config.size}
|
-V ${config.size}
|
||||||
partprobe
|
partprobe /dev/zvol/${config._parent.name}/${config.name}
|
||||||
udevadm trigger --subsystem-match=block
|
udevadm trigger --subsystem-match=block
|
||||||
udevadm settle
|
udevadm settle
|
||||||
${lib.optionalString (config.content != null) config.content._create}
|
${lib.optionalString (config.content != null) config.content._create}
|
||||||
|
|||||||
+8
-1
@@ -1,4 +1,4 @@
|
|||||||
{ config, lib, pkgs, extendModules, ... }:
|
{ config, lib, pkgs, extendModules, ... }@args:
|
||||||
let
|
let
|
||||||
diskoLib = import ./lib {
|
diskoLib = import ./lib {
|
||||||
inherit lib;
|
inherit lib;
|
||||||
@@ -71,6 +71,13 @@ in
|
|||||||
disko = builtins.trace "the .disko output is deprecated, please use .diskoScript instead" (cfg.devices._scripts pkgs).diskoScript;
|
disko = builtins.trace "the .disko output is deprecated, please use .diskoScript instead" (cfg.devices._scripts pkgs).diskoScript;
|
||||||
diskoNoDeps = builtins.trace "the .diskoNoDeps output is deprecated, please use .diskoScriptNoDeps instead" (cfg.devices._scripts pkgs).diskoScriptNoDeps;
|
diskoNoDeps = builtins.trace "the .diskoNoDeps output is deprecated, please use .diskoScriptNoDeps instead" (cfg.devices._scripts pkgs).diskoScriptNoDeps;
|
||||||
|
|
||||||
|
diskoImages = diskoLib.makeDiskImages {
|
||||||
|
nixosConfig = args;
|
||||||
|
};
|
||||||
|
diskoImagesScript = diskoLib.makeDiskImagesScript {
|
||||||
|
nixosConfig = args;
|
||||||
|
};
|
||||||
|
|
||||||
installTest = diskoLib.testLib.makeDiskoTest {
|
installTest = diskoLib.testLib.makeDiskoTest {
|
||||||
inherit extendModules pkgs;
|
inherit extendModules pkgs;
|
||||||
name = "${config.networking.hostName}-disko";
|
name = "${config.networking.hostName}-disko";
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{ pkgs ? import <nixpkgs> { }
|
{ pkgs ? import <nixpkgs> { }
|
||||||
, diskoLib ? pkgs.callPackage ../lib { }
|
, diskoLib ? pkgs.callPackage ../lib { }
|
||||||
}:
|
}:
|
||||||
diskoLib.makeDiskImageScript {
|
diskoLib.makeDiskImagesScript {
|
||||||
nixosConfig = pkgs.nixos [
|
nixosConfig = pkgs.nixos [
|
||||||
../module.nix
|
../module.nix
|
||||||
../example/simple-efi.nix
|
../example/simple-efi.nix
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{ pkgs ? import <nixpkgs> { }
|
{ pkgs ? import <nixpkgs> { }
|
||||||
, diskoLib ? pkgs.callPackage ../lib { }
|
, diskoLib ? pkgs.callPackage ../lib { }
|
||||||
}:
|
}:
|
||||||
diskoLib.makeDiskImage {
|
diskoLib.makeDiskImages {
|
||||||
nixosConfig = pkgs.nixos [
|
nixosConfig = pkgs.nixos [
|
||||||
../module.nix
|
../module.nix
|
||||||
../example/simple-efi.nix
|
../example/simple-efi.nix
|
||||||
|
|||||||
Reference in new issue
Block a user