Merge branch 'master' into bcachefs-fixes

This commit is contained in:
Jörg Thalheim 2023-03-27 12:35:52 +01:00 committed by GitHub
commit a5944cd574
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 19 additions and 15 deletions

2
disko
View file

@ -72,7 +72,7 @@ while [[ $# -gt 0 ]]; do
dry_run=y dry_run=y
;; ;;
--root-mountpoint) --root-mountpoint)
nix_args+=(--arg rootMountPoint "$2") nix_args+=(--argstr rootMountPoint "$2")
shift shift
;; ;;
--no-deps) --no-deps)

View file

@ -39,7 +39,7 @@
type = "luks"; type = "luks";
name = "crypted1"; name = "crypted1";
keyFile = "/tmp/secret.key"; keyFile = "/tmp/secret.key";
extraArgs = [ extraFormatArgs = [
"--iter-time 1" "--iter-time 1"
]; ];
content = { content = {
@ -67,7 +67,7 @@
type = "luks"; type = "luks";
name = "crypted2"; name = "crypted2";
keyFile = "/tmp/secret.key"; keyFile = "/tmp/secret.key";
extraArgs = [ extraFormatArgs = [
"--iter-time 1" "--iter-time 1"
]; ];
content = { content = {

View file

@ -30,6 +30,7 @@
content = { content = {
type = "luks"; type = "luks";
name = "crypted"; name = "crypted";
extraOpenArgs = [ "--allow-discards" ];
keyFile = "/tmp/secret.key"; keyFile = "/tmp/secret.key";
content = { content = {
type = "lvm_pv"; type = "lvm_pv";

6
flake.lock generated
View file

@ -2,11 +2,11 @@
"nodes": { "nodes": {
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1678594102, "lastModified": 1679410443,
"narHash": "sha256-OHAHYiMWJFPNxuW/PcOMlSD2tvXnEYC1jxREBADHwwQ=", "narHash": "sha256-xDHO/jixWD+y5pmW5+2q4Z4O/I/nA4MAa30svnZKK+M=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "796b4a3c1d903c4b9270cd2548fe46f524eeb886", "rev": "c9ece0059f42e0ab53ac870104ca4049df41b133",
"type": "github" "type": "github"
}, },
"original": { "original": {

View file

@ -14,7 +14,6 @@ buildLinux (args // {
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "koverstreet"; owner = "koverstreet";
repo = "bcachefs"; repo = "bcachefs";
rev = "169b584fb4c8e51aa36e4b3284f9e2e5ce6f30e4"; rev = "169b584fb4c8e51aa36e4b3284f9e2e5ce6f30e4";
sha256 = "sha256-dHKyh5sI+uZ+lSQQRIuicW9ae6uFaJosLtUbiJuMMrI="; sha256 = "sha256-dHKyh5sI+uZ+lSQQRIuicW9ae6uFaJosLtUbiJuMMrI=";
}; };

View file

@ -15,10 +15,16 @@
default = null; default = null;
description = "Path to the key for encryption"; description = "Path to the key for encryption";
}; };
extraArgs = lib.mkOption { extraFormatArgs = lib.mkOption {
type = lib.types.listOf lib.types.str; type = lib.types.listOf lib.types.str;
default = [ ]; 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; content = diskoLib.deviceType;
_meta = lib.mkOption { _meta = lib.mkOption {
@ -32,8 +38,8 @@
_create = diskoLib.mkCreateOption { _create = diskoLib.mkCreateOption {
inherit config options; inherit config options;
default = { dev }: '' default = { dev }: ''
cryptsetup -q luksFormat ${dev} ${diskoLib.maybeStr config.keyFile} ${toString config.extraArgs} cryptsetup -q luksFormat ${dev} ${diskoLib.maybeStr config.keyFile} ${toString config.extraFormatArgs}
cryptsetup luksOpen ${dev} ${config.name} ${lib.optionalString (config.keyFile != null) "--key-file ${config.keyFile}"} 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}";})} ${lib.optionalString (config.content != null) (config.content._create {dev = "/dev/mapper/${config.name}";})}
''; '';
}; };

View file

@ -44,7 +44,7 @@
vgchange -a y vgchange -a y
${lib.concatMapStrings (x: x.dev or "") (lib.attrValues lvMounts)} ${lib.concatMapStrings (x: x.dev or "") (lib.attrValues lvMounts)}
''; '';
fs = lvMounts.fs; fs = lvMounts.fs or { };
}; };
}; };
_config = lib.mkOption { _config = lib.mkOption {

View file

@ -38,9 +38,7 @@
partMounts = diskoLib.deepMergeMap (partition: partition._mount { inherit dev; }) config.partitions; partMounts = diskoLib.deepMergeMap (partition: partition._mount { inherit dev; }) config.partitions;
in in
{ {
dev = '' dev = partMounts.dev or "";
${lib.concatMapStrings (x: x.dev or "") (lib.attrValues partMounts)}
'';
fs = partMounts.fs or { }; fs = partMounts.fs or { };
}; };
}; };