+(define-public kmonad
+ (package
+ (name "kmonad")
+ (version "0.4.0")
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/david-janssen/kmonad")
+ (commit version)))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32 "064gnzzcm6fnxfiildbjmgbdxkhqvp61zrl6qhkl1pgbn27j1mll"))))
+ (build-system haskell-build-system)
+ (arguments
+ `(#:phases
+ (modify-phases %standard-phases
+ (delete 'haddock) ; Haddock fails to generate docs
+ (add-after 'install 'install-udev-rules
+ (lambda* (#:key outputs #:allow-other-keys)
+ (let* ((out (assoc-ref outputs "out"))
+ (rules (string-append out "/lib/udev/rules.d")))
+ (mkdir-p rules)
+ (call-with-output-file (string-append rules "/70-kmonad.rules")
+ (lambda (port)
+ (display
+ (string-append
+ "KERNEL==\"uinput\", MODE=\"0660\", "
+ "GROUP=\"input\", OPTIONS+=\"static_node=uinput\"\n")
+ port)))
+ #t)))
+ (add-after 'install-udev-rules 'install-documentation
+ (lambda* (#:key outputs #:allow-other-keys)
+ (let* ((out (assoc-ref outputs "out"))
+ (doc (string-append out "/share/doc/kmonad-" ,version)))
+ (install-file "README.md" doc)
+ (copy-recursively "doc" doc)
+ (copy-recursively "keymap" (string-append doc "/keymap"))
+ #t))))))
+ (inputs
+ `(("ghc-cereal" ,ghc-cereal)
+ ("ghc-exceptions" ,ghc-exceptions)
+ ("ghc-hashable" ,ghc-hashable)
+ ("ghc-lens" ,ghc-lens)
+ ("ghc-megaparsec" ,ghc-megaparsec)
+ ("ghc-optparse-applicative" ,ghc-optparse-applicative)
+ ("ghc-resourcet" ,ghc-resourcet)
+ ("ghc-rio" ,ghc-rio)
+ ("ghc-unagi-chan" ,ghc-unagi-chan)
+ ("ghc-unliftio" ,ghc-unliftio)
+ ("ghc-unordered-containers" ,ghc-unordered-containers)))
+ (home-page "https://github.com/david-janssen/kmonad")
+ (synopsis "Advanced keyboard manager")
+ (description "KMonad is a keyboard remapping utility that supports
+advanced functionality, such as custom keymap layers and modifiers, macros,
+and conditional mappings that send a different keycode when tapped or held.
+By operating at a lower level than most similar tools, it supports X11,
+Wayland, and Linux console environments alike.")
+ (license license:expat)))
+