Skip to content

Instantly share code, notes, and snippets.

@LnL7
Last active October 18, 2017 21:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LnL7/602f3f3e51819e4433fcdd594ac58389 to your computer and use it in GitHub Desktop.
Save LnL7/602f3f3e51819e4433fcdd594ac58389 to your computer and use it in GitHub Desktop.
{ config, pkgs, lib, ... }:
with lib;
let
cfg = config.programs.emacs.org-build;
in
{
options.programs.emacs.org-build = {
enable = mkEnableOption "Build init.el from Orgmode file";
source = mkOption {
type = types.path;
description = ''
The source orgfile to build as init.el
'';
};
};
config = mkIf cfg.enable {
home.file.".emacs.d/init.el".source = import ./release.nix {
inherit pkgs;
ssource = cfg.source;
};
};
}
{ config, pkgs, ... }:
# Import hm-org-build channel.
# sudo nix-channel --add https://github.com/dustinlacewell/nix-hm-org-build/archive/master.tar.gz hm-org-build
# sudo nix-channel --update
{
# Import org-build modules.
imports = [ <hm-org-build> ];
programs.emacs.enable = true;
programs.emacs.org-build.enable = true;
}
{ pkgs, source ? ./. }:
rec {
build = let
# the build uses emacs to perform the conversion
env = { buildInputs = [ pkgs.emacs ]; };
# call make-init-el to convert the file
script = ''
ln -s "${source}" ./init.org;
emacs -Q --script "${./org-build.el}" -f make-init-el;
cp ./init.el $out;
'';
in pkgs.runCommand "org-build" env script;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment