mirror of
https://github.com/nix-community/disko.git
synced 2026-11-30 13:03:28 +01:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
58fe856c7f | ||
|
|
3850c29595 | ||
|
|
88bdb254fe | ||
|
|
b93ef41a24 |
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)
|
||||
configuration. This layout is compatible with both BIOS and EFI systems.
|
||||
|
||||
Refer to the [reference manual](./reference.md) for more information about the
|
||||
Refer to the [reference manual](./reference) for more information about the
|
||||
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
|
||||
|
||||
Generated
+3
-3
@@ -2,11 +2,11 @@
|
||||
"nodes": {
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1694948089,
|
||||
"narHash": "sha256-d2B282GmQ9o8klc22/Rbbbj6r99EnELQpOQjWMyv0rU=",
|
||||
"lastModified": 1694593561,
|
||||
"narHash": "sha256-WSaIQZ5s9N9bDFkEMTw6P9eaZ9bv39ZhsiW12GtTNM0=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "5148520bfab61f99fd25fb9ff7bfbb50dad3c9db",
|
||||
"rev": "1697b7d480449b01111e352021f46e5879e47643",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
||||
+6
-6
@@ -11,10 +11,10 @@ let
|
||||
diskoLib = {
|
||||
|
||||
# like make-disk-image.nix from nixpkgs, but with disko config
|
||||
makeDiskImages = args: (import ./make-disk-image.nix ({ inherit diskoLib; } // args)).pure;
|
||||
makeDiskImage = args: (import ./make-disk-image.nix ({ inherit diskoLib; } // args)).pure;
|
||||
|
||||
# a version of makeDiskImage which runs outside of the store
|
||||
makeDiskImagesScript = args: (import ./make-disk-image.nix ({ inherit diskoLib; } // args)).impure;
|
||||
makeDiskImageScript = args: (import ./make-disk-image.nix ({ inherit diskoLib; } // args)).impure;
|
||||
|
||||
testLib = import ./tests.nix { inherit lib makeTest eval-config; };
|
||||
# like lib.types.oneOf but instead of a list takes an attrset
|
||||
@@ -24,7 +24,7 @@ let
|
||||
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}";
|
||||
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
|
||||
(lib.recursiveUpdate { value._module.args = extraArgs; } def)
|
||||
])
|
||||
@@ -183,7 +183,7 @@ let
|
||||
/* Takes a Submodules config and options argument and returns a serializable
|
||||
subset of config variables as a shell script snippet.
|
||||
*/
|
||||
defineHookVariables = { options }:
|
||||
defineHookVariables = { config, options }:
|
||||
let
|
||||
sanitizeName = lib.replaceStrings [ "-" ] [ "_" ];
|
||||
isAttrsOfSubmodule = o: o.type.name == "attrsOf" && o.type.nestedTypes.elemType.name == "submodule";
|
||||
@@ -229,7 +229,7 @@ let
|
||||
type = lib.types.str;
|
||||
default = ''
|
||||
( # ${config.type} ${concatMapStringsSep " " (n: toString (config.${n} or "")) ["name" "device" "format" "mountpoint"]} #
|
||||
${diskoLib.indent (diskoLib.defineHookVariables { inherit options; })}
|
||||
${diskoLib.indent (diskoLib.defineHookVariables { inherit config options; })}
|
||||
${config.preCreateHook}
|
||||
${diskoLib.indent attrs.default}
|
||||
${config.postCreateHook}
|
||||
@@ -238,7 +238,7 @@ let
|
||||
description = "Creation script";
|
||||
};
|
||||
|
||||
mkMountOption = { default, ... }@attrs:
|
||||
mkMountOption = { config, options, default }@attrs:
|
||||
lib.mkOption {
|
||||
internal = true;
|
||||
readOnly = true;
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@
|
||||
imageSize = lib.mkOption {
|
||||
type = lib.types.strMatching "[0-9]+[KMGTP]?";
|
||||
description = ''
|
||||
size of the image if the makeDiskImages function from diksoLib is used.
|
||||
size of the image if the makeDiskImage function from diksoLib is used.
|
||||
is used as an argument to truncate -s
|
||||
'';
|
||||
default = "2G";
|
||||
|
||||
+1
-1
@@ -107,7 +107,7 @@ in
|
||||
--typecode=${toString partition._index}:${partition.type} \
|
||||
${config.device}
|
||||
# ensure /dev/disk/by-path/..-partN exists before continuing
|
||||
partprobe ${config.device}
|
||||
partprobe
|
||||
udevadm trigger --subsystem-match=block
|
||||
udevadm settle
|
||||
${lib.optionalString (partition.content != null) partition.content._create}
|
||||
|
||||
+1
-1
@@ -114,7 +114,7 @@ in
|
||||
{
|
||||
dev = ''
|
||||
cryptsetup status ${config.name} >/dev/null 2>/dev/null ||
|
||||
cryptsetup open ${config.device} ${config.name} \
|
||||
cryptsetup luksOpen ${config.device} ${config.name} \
|
||||
${keyFileArgs}
|
||||
${lib.optionalString (config.content != null) contentMount.dev or ""}
|
||||
'';
|
||||
|
||||
+1
-1
@@ -42,7 +42,7 @@
|
||||
--force \
|
||||
--homehost=any \
|
||||
"''${disk_devices[@]}"
|
||||
partprobe /dev/md/${config.name}
|
||||
partprobe
|
||||
udevadm trigger --subsystem-match=block
|
||||
udevadm settle
|
||||
# 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}
|
||||
''}
|
||||
# ensure /dev/disk/by-path/..-partN exists before continuing
|
||||
partprobe ${config.device}
|
||||
partprobe
|
||||
udevadm trigger --subsystem-match=block
|
||||
udevadm settle
|
||||
${lib.optionalString partition.bootable ''
|
||||
@@ -101,7 +101,7 @@
|
||||
parted -s ${config.device} -- set ${toString partition._index} ${flag} on
|
||||
'') partition.flags}
|
||||
# ensure further operations can detect new partitions
|
||||
partprobe ${config.device}
|
||||
partprobe
|
||||
udevadm trigger --subsystem-match=block
|
||||
udevadm settle
|
||||
${lib.optionalString (partition.content != null) partition.content._create}
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
zfs create ${config._parent.name}/${config.name} \
|
||||
${lib.concatStringsSep " " (lib.mapAttrsToList (n: v: "-o ${n}=${v}") config.options)} \
|
||||
-V ${config.size}
|
||||
partprobe /dev/zvol/${config._parent.name}/${config.name}
|
||||
partprobe
|
||||
udevadm trigger --subsystem-match=block
|
||||
udevadm settle
|
||||
${lib.optionalString (config.content != null) config.content._create}
|
||||
|
||||
+1
-8
@@ -1,4 +1,4 @@
|
||||
{ config, lib, pkgs, extendModules, ... }@args:
|
||||
{ config, lib, pkgs, extendModules, ... }:
|
||||
let
|
||||
diskoLib = import ./lib {
|
||||
inherit lib;
|
||||
@@ -71,13 +71,6 @@ in
|
||||
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;
|
||||
|
||||
diskoImages = diskoLib.makeDiskImages {
|
||||
nixosConfig = args;
|
||||
};
|
||||
diskoImagesScript = diskoLib.makeDiskImagesScript {
|
||||
nixosConfig = args;
|
||||
};
|
||||
|
||||
installTest = diskoLib.testLib.makeDiskoTest {
|
||||
inherit extendModules pkgs;
|
||||
name = "${config.networking.hostName}-disko";
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{ pkgs ? import <nixpkgs> { }
|
||||
, diskoLib ? pkgs.callPackage ../lib { }
|
||||
}:
|
||||
diskoLib.makeDiskImagesScript {
|
||||
diskoLib.makeDiskImageScript {
|
||||
nixosConfig = pkgs.nixos [
|
||||
../module.nix
|
||||
../example/simple-efi.nix
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{ pkgs ? import <nixpkgs> { }
|
||||
, diskoLib ? pkgs.callPackage ../lib { }
|
||||
}:
|
||||
diskoLib.makeDiskImages {
|
||||
diskoLib.makeDiskImage {
|
||||
nixosConfig = pkgs.nixos [
|
||||
../module.nix
|
||||
../example/simple-efi.nix
|
||||
|
||||
Reference in new issue
Block a user