2019-07-25 03:58:51 +03:00
|
|
|
{ nixpkgs ? import <nixpkgs> {} }:
|
|
|
|
|
|
|
|
let
|
|
|
|
inherit (nixpkgs) callPackage pkgs stdenv;
|
2023-12-20 00:45:54 +03:00
|
|
|
|
2019-07-25 03:58:51 +03:00
|
|
|
pbkdf2Sha512 = callPackage ./pbkdf2-sha512 { };
|
2023-12-20 00:45:54 +03:00
|
|
|
rbtohex = pkgs.writeShellScriptBin
|
|
|
|
"rbtohex"
|
|
|
|
''( od -An -vtx1 | tr -d ' \n' )'';
|
|
|
|
hextorb = pkgs.writeShellScriptBin
|
|
|
|
"hextorb"
|
|
|
|
''( tr '[:lower:]' '[:upper:]' | sed -e 's/\([0-9A-F]\{2\}\)/\\\\\\x\1/gI'| xargs printf )'';
|
2023-12-20 01:01:34 +03:00
|
|
|
yk-luks-open = pkgs.writeShellScriptBin "yk-luks-open" "${./yk-luks-open.sh} $@";
|
2019-07-25 03:58:51 +03:00
|
|
|
in
|
|
|
|
stdenv.mkDerivation {
|
|
|
|
name = "yubikey-luks-setup";
|
|
|
|
buildInputs = with pkgs; [
|
|
|
|
cryptsetup
|
|
|
|
openssl
|
|
|
|
parted
|
|
|
|
pbkdf2Sha512
|
|
|
|
yubikey-personalization
|
2023-12-20 00:45:54 +03:00
|
|
|
rbtohex
|
|
|
|
hextorb
|
2023-12-20 01:01:34 +03:00
|
|
|
yk-luks-open
|
2019-07-25 03:58:51 +03:00
|
|
|
];
|
|
|
|
}
|