Skip to content

Commit

Permalink
feat: Add an input option to remove IFD
Browse files Browse the repository at this point in the history
  • Loading branch information
akirak committed Nov 23, 2023
1 parent 9c3c6ba commit c4611dd
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions pkgs/emacs/data/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,21 @@ in

# builtins.readFile fails when the source file contains control characters.
# pydoc.el is an example. A workaround is to take only the first N bytes of
# the file using `head` command and read its output.
# the file using `head` command and read its output. This is IFD, which
# effectively prevents you from adding elisp packages directly to the flake
# outputs.
headers =
lib.parseElispHeaders
(lib.readFirstBytes
# magit.el has a relatively long header, so other libraries would be shorter.
1500
(self.src + "/${self.mainFile}"));
(
# Add support for an option to remove IFD.
if self.mainIsAscii or false
then builtins.readFile (self.src + "/${self.mainFile}")
else
(lib.readFirstBytes
# magit.el has a relatively long header, so other libraries would be shorter.
1500
(self.src + "/${self.mainFile}"))
);
in
lib.getAttrs
(filter (name: hasAttr name attrs) [
Expand Down

0 comments on commit c4611dd

Please sign in to comment.