Skip to content

Instantly share code, notes, and snippets.

@gshpychka
Created June 19, 2023 18:00
Show Gist options
  • Save gshpychka/6cf2efbf35d7c4235a0dbfb170ec772e to your computer and use it in GitHub Desktop.
Save gshpychka/6cf2efbf35d7c4235a0dbfb170ec772e to your computer and use it in GitHub Desktop.
Swift derivation
with import <nixpkgs> { };
stdenv.mkDerivation rec {
name = "watchid-pam-extension-${version}";
src = fetchFromGitHub {
owner = "jnooree";
repo = "pam-watchid";
rev = "main";
sha256 = "Ni8yyn0dKO8N7SSOeYJMl2XI83chKbDbdpOMegx9k9k=";
};
version = "2";
libraryName = "pam_watchid.so";
destination = "/usr/local/lib/pam";
target = "arm64-apple-darwin22.5.0";
buildInputs = [
pkgs.darwin.apple_sdk.frameworks.LocalAuthentication
];
buildPhase = ''
${pkgs.swift}/bin/swiftc ${src}/watchid-pam-extension.swift -target ${target} -O -Ounchecked -gnone -o $out/${libraryName} -emit-library
'';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment