1
0

Import into git

This commit is contained in:
Thibault “Adædra” Hamel 2024-04-17 02:08:20 +02:00
parent 6453166421
commit 743ca6424e
3 changed files with 64 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/result

25
flake.lock Normal file
View File

@ -0,0 +1,25 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1713254108,
"narHash": "sha256-0TZIsfDbHG5zibtlw6x0yOp3jkInIGaJ35B7Y4G8Pec=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "2fd19c8be2551a61c1ddc3d9f86d748f4db94f00",
"type": "github"
},
"original": {
"id": "nixpkgs",
"type": "indirect"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

38
flake.nix Normal file
View File

@ -0,0 +1,38 @@
{
outputs = { self, nixpkgs }: {
packages.aarch64-darwin = let
pkgs = import nixpkgs { system = "aarch64-darwin"; };
in {
default = pkgs.stdenv.mkDerivation {
# Based on https://gist.github.com/thelastlin/c45b96cf460919e39ab5807b6d20ac2a
inherit (pkgs.openssh) version src;
pname = "libsk-libfido2";
patches = [
(builtins.fetchurl {
url = "https://gist.githubusercontent.com/thelastlin/c45b96cf460919e39ab5807b6d20ac2a/raw/d84ee70a8f0d8cf846ae8b9f1fa6a4071797123e/workaround-standalone-libsk.patch";
sha256 = "sha256:0bgzv7ch2cx9gjjy78fg4nr0i4icdh88s2jfn6x1hsv32vdsyqpw";
})
];
nativeBuildInputs = with pkgs; [ pkg-config libfido2 zlib ];
configureFlags = [ "--with-security-key-builtin=yes" ];
buildPhase = ''
make libssh.a CFLAGS="-O2 -fPIC"
make openbsd-compat/libopenbsd-compat.a CFLAGS="-O2 -fPIC"
make sk-usbhid.o CFLAGS="-O2 -DSK_STANDALONE -fPIC"
(
eval "$(grep -E '^(CC|LDFLAGS|LIBFIDO2)=' Makefile | sed -e 's;=;=";' -e 's;$;";')"
$CC -shared openbsd-compat/libopenbsd-compat.a sk-usbhid.o libssh.a -O2 -fPIC -flto -Wl,-dead_strip,-exported_symbol,_sk_\* $LDFLAGS $LIBFIDO2 -o libsk-libfido2.dylib
)
'';
installPhase = ''
mkdir -p "$out/libexec"
cp libsk-libfido2.dylib "$out/libexec/"
'';
};
};
};
}