110 lines
3.2 KiB
Nix
110 lines
3.2 KiB
Nix
{
|
|
inputs,
|
|
pkgs,
|
|
...
|
|
}:
|
|
let
|
|
emacs = import ./common.nix {
|
|
lib = pkgs.lib;
|
|
inherit pkgs;
|
|
stylixEnabled = false;
|
|
emacsExtraConfig = "";
|
|
emacsExtraPackages = _epkgs: [ ];
|
|
};
|
|
portableFonts =
|
|
let
|
|
customFonts = pkgs.stdenvNoCC.mkDerivation {
|
|
name = "portable-emacs-fonts";
|
|
src = inputs.fonts;
|
|
installPhase = ''
|
|
mkdir -p $out/share/fonts
|
|
find $src -type f \( \
|
|
-name "*.ttf" -o \
|
|
-name "*.otf" -o \
|
|
-name "*.woff" -o \
|
|
-name "*.woff2" \
|
|
\) -exec cp {} $out/share/fonts/ \;
|
|
'';
|
|
};
|
|
in
|
|
builtins.attrValues {
|
|
inherit customFonts;
|
|
inherit (pkgs.nerd-fonts)
|
|
comic-shanns-mono
|
|
iosevka
|
|
caskaydia-cove
|
|
;
|
|
};
|
|
portableHome = inputs.home-manager.lib.homeManagerConfiguration {
|
|
inherit pkgs;
|
|
modules = [
|
|
../../../modules/home-manager.nix
|
|
../../../config/home-manager.nix
|
|
{
|
|
home = {
|
|
username = "portable";
|
|
homeDirectory = if pkgs.stdenv.isDarwin then "/Users/portable" else "/home/portable";
|
|
stateVersion = "23.05";
|
|
};
|
|
programs.home-manager.enable = true;
|
|
nixpkgs.config.allowUnfree = true;
|
|
my = {
|
|
emacs.enable = true;
|
|
dev = {
|
|
nix.enable = true;
|
|
python.enable = true;
|
|
sh.enable = true;
|
|
};
|
|
shell.tools.enable = true;
|
|
};
|
|
}
|
|
];
|
|
extraSpecialArgs = {
|
|
inherit inputs;
|
|
outputs = inputs.self;
|
|
osConfig = null;
|
|
preferredShell = "zsh";
|
|
userEmail = "danilo.reyes.251@proton.me";
|
|
};
|
|
};
|
|
templateFarm = pkgs.linkFarm "portable-emacs-templates" (
|
|
builtins.attrNames emacs.templateFiles
|
|
|> map (name: {
|
|
inherit name;
|
|
path = emacs.templateFiles.${name};
|
|
})
|
|
);
|
|
fontConfig = pkgs.makeFontsConf {
|
|
fontDirectories = map (font: "${font}/share/fonts") portableFonts;
|
|
};
|
|
package = pkgs.writeShellApplication {
|
|
name = "doom-emacs";
|
|
runtimeInputs = [
|
|
portableHome.config.programs.doom-emacs.finalEmacsPackage
|
|
]
|
|
++ portableHome.config.home.packages;
|
|
text = ''
|
|
export HOME="''${HOME:?HOME must be set}"
|
|
export XDG_CONFIG_HOME="''${XDG_CONFIG_HOME:-$HOME/.config}"
|
|
export XDG_CACHE_HOME="''${XDG_CACHE_HOME:-$HOME/.cache}"
|
|
export XDG_STATE_HOME="''${XDG_STATE_HOME:-$HOME/.local/state}"
|
|
export XDG_DATA_HOME="''${XDG_DATA_HOME:-$HOME/.local/share}"
|
|
export DOOMDIR="${emacs.doomDir}"
|
|
export DOOMLOCALDIR="$XDG_DATA_HOME/nix-doom"
|
|
export FONTCONFIG_FILE="${fontConfig}"
|
|
mkdir -p "$XDG_DATA_HOME/doom/templates" "$DOOMLOCALDIR" "$XDG_CACHE_HOME" "$XDG_STATE_HOME"
|
|
ln -sfn "${templateFarm}/events.org" "$XDG_DATA_HOME/doom/templates/events.org"
|
|
ln -sfn "${templateFarm}/default.org" "$XDG_DATA_HOME/doom/templates/default.org"
|
|
ln -sfn "${templateFarm}/programming.org" "$XDG_DATA_HOME/doom/templates/programming.org"
|
|
exec ${portableHome.config.programs.doom-emacs.finalEmacsPackage}/bin/emacs "$@"
|
|
'';
|
|
};
|
|
in
|
|
{
|
|
inherit package;
|
|
app = {
|
|
type = "app";
|
|
program = "${package}/bin/doom-emacs";
|
|
};
|
|
}
|