nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 fetchpatch2,
6 swift,
7 versionCheckHook,
8}:
9
10stdenv.mkDerivation (finalAttrs: {
11 pname = "macism";
12 version = "3.0.10";
13
14 src = fetchFromGitHub {
15 owner = "laishulu";
16 repo = "macism";
17 tag = "v${finalAttrs.version}";
18 hash = "sha256-TNZoVCGbWYZHWL1hgdq9p+RrbsWLtL8FuNpf0OvN+uM=";
19 };
20
21 patches = [
22 # Fix version check to work with nix build environment
23 (fetchpatch2 {
24 name = "fix-version-check";
25 url = "https://github.com/laishulu/macism/commit/928f6f55e9cdaaf39ae5fe7ce7f803d608c68565.patch?full_index=1";
26 hash = "sha256-9rh1bxpYMOKNumAthZBNluJbbH5HLI9PfM6hGzxGpjU=";
27 })
28 ];
29
30 dontConfigure = true;
31
32 nativeBuildInputs = [
33 swift
34 ];
35
36 installPhase = ''
37 runHook preInstall
38
39 mkdir -p $out/bin
40 cp macism $out/bin
41
42 mkdir -p $out/Applications
43 cp -r TemporaryWindow.app $out/Applications
44
45 runHook postInstall
46 '';
47
48 nativeInstallCheckInputs = [ versionCheckHook ];
49 versionCheckProgramArg = "--version";
50 doInstallCheck = true;
51
52 meta = {
53 description = "Reliable CLI MacOS input source manager";
54 longDescription = ''
55 This tool manages macOS input sources from the command line, ideal for
56 integration with vim and emacs(e.g. sis).
57
58 macism's main advantage over other similar tools is that it can reliably
59 select CJKV(Chinese/Japanese/Korean/Vietnamese) input source, while with
60 other tools (such as input-source-switcher, im-select from smartim, swim),
61 when you switch to CJKV input source, you will see that the input source
62 icon has already changed in the menu bar, but unless you activate other
63 applications and then switch back, the input source is actually still the
64 same as before.
65 '';
66 homepage = "https://github.com/laishulu/macism";
67 maintainers = with lib.maintainers; [
68 yzx9
69 ];
70 license = lib.licenses.mit;
71 platforms = lib.platforms.darwin;
72 mainProgram = "macism";
73 };
74})