diff --git a/disko b/disko index c84cf52..817c5b6 100755 --- a/disko +++ b/disko @@ -72,7 +72,7 @@ while [[ $# -gt 0 ]]; do dry_run=y ;; --root-mountpoint) - nix_args+=(--arg rootMountPoint "$2") + nix_args+=(--argstr rootMountPoint "$2") shift ;; --no-deps) diff --git a/example/complex.nix b/example/complex.nix index 939f71e..1c02ef9 100644 --- a/example/complex.nix +++ b/example/complex.nix @@ -39,7 +39,7 @@ type = "luks"; name = "crypted1"; keyFile = "/tmp/secret.key"; - extraArgs = [ + extraFormatArgs = [ "--iter-time 1" ]; content = { @@ -67,7 +67,7 @@ type = "luks"; name = "crypted2"; keyFile = "/tmp/secret.key"; - extraArgs = [ + extraFormatArgs = [ "--iter-time 1" ]; content = { diff --git a/example/luks-lvm.nix b/example/luks-lvm.nix index a6879ce..51cd24c 100644 --- a/example/luks-lvm.nix +++ b/example/luks-lvm.nix @@ -30,6 +30,7 @@ content = { type = "luks"; name = "crypted"; + extraOpenArgs = [ "--allow-discards" ]; keyFile = "/tmp/secret.key"; content = { type = "lvm_pv"; diff --git a/flake.lock b/flake.lock index 1d0d394..c049394 100644 --- a/flake.lock +++ b/flake.lock @@ -2,11 +2,11 @@ "nodes": { "nixpkgs": { "locked": { - "lastModified": 1678594102, - "narHash": "sha256-OHAHYiMWJFPNxuW/PcOMlSD2tvXnEYC1jxREBADHwwQ=", + "lastModified": 1679410443, + "narHash": "sha256-xDHO/jixWD+y5pmW5+2q4Z4O/I/nA4MAa30svnZKK+M=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "796b4a3c1d903c4b9270cd2548fe46f524eeb886", + "rev": "c9ece0059f42e0ab53ac870104ca4049df41b133", "type": "github" }, "original": { diff --git a/linux-testing-bcachefs.nix b/linux-testing-bcachefs.nix index 1287803..2d0b99f 100644 --- a/linux-testing-bcachefs.nix +++ b/linux-testing-bcachefs.nix @@ -14,7 +14,6 @@ buildLinux (args // { src = fetchFromGitHub { owner = "koverstreet"; repo = "bcachefs"; - rev = "169b584fb4c8e51aa36e4b3284f9e2e5ce6f30e4"; sha256 = "sha256-dHKyh5sI+uZ+lSQQRIuicW9ae6uFaJosLtUbiJuMMrI="; }; diff --git a/types/luks.nix b/types/luks.nix index 90fcdcc..350a238 100644 --- a/types/luks.nix +++ b/types/luks.nix @@ -15,10 +15,16 @@ default = null; description = "Path to the key for encryption"; }; - extraArgs = lib.mkOption { + extraFormatArgs = lib.mkOption { type = lib.types.listOf lib.types.str; default = [ ]; - description = "Extra arguments"; + description = "Extra arguments to pass to `cryptsetup luksFormat` when formatting"; + }; + extraOpenArgs = lib.mkOption { + type = lib.types.listOf lib.types.str; + default = [ ]; + description = "Extra arguments to pass to `cryptsetup luksOpen` when opening"; + example = [ "--allow-discards" ]; }; content = diskoLib.deviceType; _meta = lib.mkOption { @@ -32,8 +38,8 @@ _create = diskoLib.mkCreateOption { inherit config options; default = { dev }: '' - cryptsetup -q luksFormat ${dev} ${diskoLib.maybeStr config.keyFile} ${toString config.extraArgs} - cryptsetup luksOpen ${dev} ${config.name} ${lib.optionalString (config.keyFile != null) "--key-file ${config.keyFile}"} + cryptsetup -q luksFormat ${dev} ${diskoLib.maybeStr config.keyFile} ${toString config.extraFormatArgs} + cryptsetup luksOpen ${dev} ${config.name} ${toString config.extraOpenArgs} ${lib.optionalString (config.keyFile != null) "--key-file ${config.keyFile}"} ${lib.optionalString (config.content != null) (config.content._create {dev = "/dev/mapper/${config.name}";})} ''; }; diff --git a/types/lvm_vg.nix b/types/lvm_vg.nix index ac7c2fa..70845ff 100644 --- a/types/lvm_vg.nix +++ b/types/lvm_vg.nix @@ -44,7 +44,7 @@ vgchange -a y ${lib.concatMapStrings (x: x.dev or "") (lib.attrValues lvMounts)} ''; - fs = lvMounts.fs; + fs = lvMounts.fs or { }; }; }; _config = lib.mkOption { diff --git a/types/table.nix b/types/table.nix index fee81a5..b47ed29 100644 --- a/types/table.nix +++ b/types/table.nix @@ -38,9 +38,7 @@ partMounts = diskoLib.deepMergeMap (partition: partition._mount { inherit dev; }) config.partitions; in { - dev = '' - ${lib.concatMapStrings (x: x.dev or "") (lib.attrValues partMounts)} - ''; + dev = partMounts.dev or ""; fs = partMounts.fs or { }; }; };