Skip to content

Instantly share code, notes, and snippets.

@reckenrode
Created June 20, 2025 00:23
Show Gist options
  • Select an option

  • Save reckenrode/fb0ece433e0d04ade0f56a3a532924a3 to your computer and use it in GitHub Desktop.

Select an option

Save reckenrode/fb0ece433e0d04ade0f56a3a532924a3 to your computer and use it in GitHub Desktop.
dark-mode with new Swift in nixpkgs
{
fetchFromGitHub,
stdenv,
swift,
xcbuildHook,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "dark-mode";
version = "3.0.2";
src = fetchFromGitHub {
owner = "sindresorhus";
repo = "dark-mode";
tag = "v${finalAttrs.version}";
hash = "sha256-vgk26fXrtICYyjxsAomVsgr+iEf3ca3U+KRyXF0HxTM=";
};
postPatch = ''
substituteInPlace dark-mode.xcodeproj/project.pbxproj \
--replace-fail 'MACOSX_DEPLOYMENT_TARGET = 10.10' 'MACOSX_DEPLOYMENT_TARGET = ${stdenv.hostPlatform.darwinMinVersion}'
'';
strictDeps = true;
nativeBuildInputs = [
swift
xcbuildHook
];
installPhase = ''
runHook preInstall
install -D -m755 -t "$out/bin" Products/Release/dark-mode
runHook postInstall
'';
env.NIX_CFLAGS_LINK = "-L/usr/lib/swift -lswiftCore";
__structuredAttrs = true;
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment