Compare commits

..
4 Commits
Author SHA1 Message Date
Jörg Thalheim 58fe856c7f reformat tree 2023-09-15 09:40:35 +02:00
Jörg Thalheim 3850c29595 replace statix with deadnix
statix does sometimes weird stuff while deadnix is even better at finding deadcode
2023-09-15 09:40:35 +02:00
Jörg Thalheim 88bdb254fe add deno to formatters 2023-09-15 08:04:36 +02:00
Jörg Thalheim b93ef41a24 update command line reference 2023-09-15 08:04:36 +02:00
12 changed files with 20 additions and 27 deletions

No files matched your search

+1 -1
View File
@@ -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.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. 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
View File
@@ -2,11 +2,11 @@
"nodes": { "nodes": {
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1694948089, "lastModified": 1694593561,
"narHash": "sha256-d2B282GmQ9o8klc22/Rbbbj6r99EnELQpOQjWMyv0rU=", "narHash": "sha256-WSaIQZ5s9N9bDFkEMTw6P9eaZ9bv39ZhsiW12GtTNM0=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "5148520bfab61f99fd25fb9ff7bfbb50dad3c9db", "rev": "1697b7d480449b01111e352021f46e5879e47643",
"type": "github" "type": "github"
}, },
"original": { "original": {
+6 -6
View File
@@ -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
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 # 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; }; 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 = { options }: defineHookVariables = { config, 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 options; })} ${diskoLib.indent (diskoLib.defineHookVariables { inherit config 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 = { default, ... }@attrs: mkMountOption = { config, options, default }@attrs:
lib.mkOption { lib.mkOption {
internal = true; internal = true;
readOnly = true; readOnly = true;
+1 -1
View File
@@ -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 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 is used as an argument to truncate -s
''; '';
default = "2G"; default = "2G";
+1 -1
View File
@@ -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 ${config.device} partprobe
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
View File
@@ -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 open ${config.device} ${config.name} \ cryptsetup luksOpen ${config.device} ${config.name} \
${keyFileArgs} ${keyFileArgs}
${lib.optionalString (config.content != null) contentMount.dev or ""} ${lib.optionalString (config.content != null) contentMount.dev or ""}
''; '';
+1 -1
View File
@@ -42,7 +42,7 @@
--force \ --force \
--homehost=any \ --homehost=any \
"''${disk_devices[@]}" "''${disk_devices[@]}"
partprobe /dev/md/${config.name} partprobe
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
View File
@@ -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 ${config.device} partprobe
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 ${config.device} partprobe
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
View File
@@ -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 /dev/zvol/${config._parent.name}/${config.name} partprobe
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}
+1 -8
View File
@@ -1,4 +1,4 @@
{ config, lib, pkgs, extendModules, ... }@args: { config, lib, pkgs, extendModules, ... }:
let let
diskoLib = import ./lib { diskoLib = import ./lib {
inherit 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; 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 -1
View File
@@ -1,7 +1,7 @@
{ pkgs ? import <nixpkgs> { } { pkgs ? import <nixpkgs> { }
, diskoLib ? pkgs.callPackage ../lib { } , diskoLib ? pkgs.callPackage ../lib { }
}: }:
diskoLib.makeDiskImagesScript { diskoLib.makeDiskImageScript {
nixosConfig = pkgs.nixos [ nixosConfig = pkgs.nixos [
../module.nix ../module.nix
../example/simple-efi.nix ../example/simple-efi.nix
+1 -1
View File
@@ -1,7 +1,7 @@
{ pkgs ? import <nixpkgs> { } { pkgs ? import <nixpkgs> { }
, diskoLib ? pkgs.callPackage ../lib { } , diskoLib ? pkgs.callPackage ../lib { }
}: }:
diskoLib.makeDiskImages { diskoLib.makeDiskImage {
nixosConfig = pkgs.nixos [ nixosConfig = pkgs.nixos [
../module.nix ../module.nix
../example/simple-efi.nix ../example/simple-efi.nix