home/modules/baremacs:init
move emacs to home-manager
This commit is contained in:
72
flake.lock
generated
72
flake.lock
generated
@@ -18,11 +18,11 @@
|
|||||||
},
|
},
|
||||||
"emacs": {
|
"emacs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1647162387,
|
"lastModified": 1647335267,
|
||||||
"narHash": "sha256-TK3jhGCsQkzlz43iKwUYk5c1xDZm2LkPn9LxpWczYs8=",
|
"narHash": "sha256-O//CN+V9b7dbnDmWRdrMFVk2Uq0COMLh8PryN4W7fIc=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "emacs-overlay",
|
"repo": "emacs-overlay",
|
||||||
"rev": "43fa2ef6dc8e0f9dbbbb26564b22b75478b7ef0b",
|
"rev": "d43b200ed5675bf912440975435dd7a7363f9481",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -97,11 +97,11 @@
|
|||||||
"nixpkgs": "nixpkgs"
|
"nixpkgs": "nixpkgs"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1647174789,
|
"lastModified": 1647210221,
|
||||||
"narHash": "sha256-baXTzUZDx3KQ6PH5SvuiurgCnE417S+Za3q5FtSZiPo=",
|
"narHash": "sha256-mUWwEq+ReRQjIqj28ClqmBDyKV4fr6C5ufqlXLzZFsk=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "home-manager",
|
"repo": "home-manager",
|
||||||
"rev": "5d4327cff4a5e54be8ca33d7c8a8dce6bdb64b93",
|
"rev": "8eb7c009f09f1f7b1ec151e5d537104acf42213a",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -151,11 +151,11 @@
|
|||||||
},
|
},
|
||||||
"master": {
|
"master": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1647176932,
|
"lastModified": 1647362511,
|
||||||
"narHash": "sha256-822tW7LLmC/eoR70szNeyvsHIje24brAgbfixp37iuk=",
|
"narHash": "sha256-eVJNniAVP8RSH9EWcAnj1td9jJkY+J257QD6wfd7FLQ=",
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "d853dc52d87692619412a074846144262d6a48b3",
|
"rev": "d1b993abaa6dc6df5014bb70fd1111f39f310bec",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -194,11 +194,11 @@
|
|||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"dir": "contrib",
|
"dir": "contrib",
|
||||||
"lastModified": 1647152497,
|
"lastModified": 1647310800,
|
||||||
"narHash": "sha256-KNqAdyM0DQPSqb/low6Py9eUBQjfga0KAHAF6naMd7Y=",
|
"narHash": "sha256-DvKvdwXp1K8dtxk+IIGK/HxurmMRhkuTdfj44rDRsdw=",
|
||||||
"owner": "neovim",
|
"owner": "neovim",
|
||||||
"repo": "neovim",
|
"repo": "neovim",
|
||||||
"rev": "c9b94188d5f96349566372e8a0ce94e14fd6b549",
|
"rev": "bef7552f7088ff411bd68fc236cfd7b269ad157e",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -229,11 +229,11 @@
|
|||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1646955661,
|
"lastModified": 1647350163,
|
||||||
"narHash": "sha256-AYLta1PubJnrkv15+7G+6ErW5m9NcI9wSdJ+n7pKAe0=",
|
"narHash": "sha256-OcMI+PFEHTONthXuEQNddt16Ml7qGvanL3x8QOl2Aao=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "e9545762b032559c27d8ec9141ed63ceca1aa1ac",
|
"rev": "3eb07eeafb52bcbf02ce800f032f18d666a9498d",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -243,11 +243,11 @@
|
|||||||
},
|
},
|
||||||
"nixpkgs_2": {
|
"nixpkgs_2": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1646955661,
|
"lastModified": 1647350163,
|
||||||
"narHash": "sha256-AYLta1PubJnrkv15+7G+6ErW5m9NcI9wSdJ+n7pKAe0=",
|
"narHash": "sha256-OcMI+PFEHTONthXuEQNddt16Ml7qGvanL3x8QOl2Aao=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "e9545762b032559c27d8ec9141ed63ceca1aa1ac",
|
"rev": "3eb07eeafb52bcbf02ce800f032f18d666a9498d",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -302,11 +302,11 @@
|
|||||||
},
|
},
|
||||||
"nixpkgs_6": {
|
"nixpkgs_6": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1646955661,
|
"lastModified": 1647350163,
|
||||||
"narHash": "sha256-AYLta1PubJnrkv15+7G+6ErW5m9NcI9wSdJ+n7pKAe0=",
|
"narHash": "sha256-OcMI+PFEHTONthXuEQNddt16Ml7qGvanL3x8QOl2Aao=",
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "e9545762b032559c27d8ec9141ed63ceca1aa1ac",
|
"rev": "3eb07eeafb52bcbf02ce800f032f18d666a9498d",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -318,11 +318,11 @@
|
|||||||
},
|
},
|
||||||
"nixpkgs_7": {
|
"nixpkgs_7": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1646939531,
|
"lastModified": 1647125019,
|
||||||
"narHash": "sha256-bxOjVqcsccCNm+jSmEh/bm0tqfE3SdjwS+p+FZja3ho=",
|
"narHash": "sha256-PXA76/iIqtbrA0ydCyc7Wpdw7TQTnfEowM87YtTXfB4=",
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "fcd48a5a0693f016a5c370460d0c2a8243b882dc",
|
"rev": "b0e141e3fe13ec21f50429773d2e3890e02a80da",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -350,11 +350,11 @@
|
|||||||
},
|
},
|
||||||
"nur": {
|
"nur": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1647175668,
|
"lastModified": 1647319391,
|
||||||
"narHash": "sha256-6AKGFi5BI6/u4Ux9a66hXTZ7jNmDdmlVZS71lL6EWL4=",
|
"narHash": "sha256-aP33NF1dw0keAsRcT6f416NMR6sqyoMiRmFz3YgTWsM=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "NUR",
|
"repo": "NUR",
|
||||||
"rev": "528c18d44723070591ac643a2ad1885b86a48904",
|
"rev": "b8be7192aa2050aadfd06cd14c776f0478e9a146",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -370,11 +370,11 @@
|
|||||||
"nixpkgs": "nixpkgs_7"
|
"nixpkgs": "nixpkgs_7"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1647159229,
|
"lastModified": 1647332154,
|
||||||
"narHash": "sha256-aGawpstqvThlV5OWqCAFIFBc8apYvMT/Qwig111coSo=",
|
"narHash": "sha256-fCZWPR53MfOHhVC4VEjYeIWPzJbCo/lLOubNoswfTS0=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "neovim-nightly-overlay",
|
"repo": "neovim-nightly-overlay",
|
||||||
"rev": "4cf0e4a5738fb247f191a35c7c3900c4f06caca3",
|
"rev": "0817ca26e18dbf5eb8dc61a7e68f9d7f6b3fbe68",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -423,11 +423,11 @@
|
|||||||
"nixpkgs": "nixpkgs_8"
|
"nixpkgs": "nixpkgs_8"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1647138040,
|
"lastModified": 1647311412,
|
||||||
"narHash": "sha256-rG9G4ND7hoG7VVIe614s0s76jEcZjhFm1JO1m5EiSsI=",
|
"narHash": "sha256-QS/7FRv48jCp/5t9jAgJL+Psx+wuUdwu5g35XHLmpDw=",
|
||||||
"owner": "oxalica",
|
"owner": "oxalica",
|
||||||
"repo": "rust-overlay",
|
"repo": "rust-overlay",
|
||||||
"rev": "c984623eb0584a2aadeca505dd85ec68a3f5a576",
|
"rev": "e005f7e14ce46b4309ac723ba2c8acbc6c6cee61",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -438,11 +438,11 @@
|
|||||||
},
|
},
|
||||||
"stable": {
|
"stable": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1646933238,
|
"lastModified": 1647282937,
|
||||||
"narHash": "sha256-RZJnLN0o4B35eTnUc2tEAD12X5TNeeJhhvH3Fd6Pmdo=",
|
"narHash": "sha256-K8Oo6QyFCfiEWTRpQVfzcwI3YNMKlz6Tu8rr+o3rzRQ=",
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "bacbfd713b4781a4a82c1f390f8fe21ae3b8b95b",
|
"rev": "64fc73bd74f04d3e10cb4e70e1c65b92337e76db",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@@ -59,7 +59,6 @@
|
|||||||
./modules/nvidia-offload.nix
|
./modules/nvidia-offload.nix
|
||||||
./modules/sound.nix
|
./modules/sound.nix
|
||||||
./modules/xorg.nix
|
./modules/xorg.nix
|
||||||
./modules/emacs
|
|
||||||
];
|
];
|
||||||
commonModules = [
|
commonModules = [
|
||||||
./modules/nvim
|
./modules/nvim
|
||||||
@@ -71,6 +70,7 @@
|
|||||||
];
|
];
|
||||||
homeModules = [
|
homeModules = [
|
||||||
./home/modules/secret.nix
|
./home/modules/secret.nix
|
||||||
|
./home/modules/baremacs.nix
|
||||||
];
|
];
|
||||||
builders = [ ./modules/x86builder.nix ];
|
builders = [ ./modules/x86builder.nix ];
|
||||||
in
|
in
|
||||||
|
@@ -4,14 +4,9 @@ echo "You're about to switch your home-manager configuration as '$USER'"
|
|||||||
read -p "Continue (y/n)?" conf
|
read -p "Continue (y/n)?" conf
|
||||||
|
|
||||||
if [[ ${conf,,} =~ ^(y|yes)$ ]]; then
|
if [[ ${conf,,} =~ ^(y|yes)$ ]]; then
|
||||||
read -p "Do you want to use sudo instead of doas? (y/n)" conf2
|
nix build .\#hm-configs.$USER.activationPackage -o hm-result &&
|
||||||
elev="doas"
|
|
||||||
if [[ ${conf2,,} =~ ^(y|yes)$ ]]; then
|
|
||||||
elev="sudo"
|
|
||||||
fi
|
|
||||||
$elev nix build .\#hm-configs.$USER.activationPackage -o hm-result
|
|
||||||
./hm-result/activate
|
./hm-result/activate
|
||||||
$elev unlink hm-result
|
unlink hm-result
|
||||||
else
|
else
|
||||||
echo "If this is not you, then log into your profile first!"
|
echo "If this is not you, then log into your profile first!"
|
||||||
exit 1
|
exit 1
|
||||||
|
164
home/modules/baremacs.nix
Normal file
164
home/modules/baremacs.nix
Normal file
@@ -0,0 +1,164 @@
|
|||||||
|
#modified version of home-manager emacs service module for personal use
|
||||||
|
|
||||||
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
|
with lib;
|
||||||
|
|
||||||
|
let
|
||||||
|
cfg = config.services.baremacs;
|
||||||
|
emacsCfg = config.programs.emacs;
|
||||||
|
emacsBinPath = "${cfg.package}/bin";
|
||||||
|
|
||||||
|
# Match the default socket path for the Emacs version so emacsclient continues
|
||||||
|
# to work without wrapping it.
|
||||||
|
socketDir = "%t/emacs";
|
||||||
|
socketPath = "${socketDir}/server";
|
||||||
|
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.services.baremacs = {
|
||||||
|
enable = mkEnableOption "the Emacs daemon";
|
||||||
|
|
||||||
|
package = mkOption {
|
||||||
|
type = types.package;
|
||||||
|
default = pkgs.emacs;
|
||||||
|
defaultText = literalExpression ''
|
||||||
|
pkgs.emacs
|
||||||
|
'';
|
||||||
|
description = "The Emacs package to use.";
|
||||||
|
};
|
||||||
|
|
||||||
|
socketActivation = {
|
||||||
|
enable = mkEnableOption "systemd socket activation for the Emacs service";
|
||||||
|
};
|
||||||
|
|
||||||
|
defaultEditor = {
|
||||||
|
enable = mkOption rec {
|
||||||
|
type = types.bool;
|
||||||
|
default = false;
|
||||||
|
example = !default;
|
||||||
|
description = "Whether to change the EDITOR environment variable or not";
|
||||||
|
};
|
||||||
|
editor = mkOption rec {
|
||||||
|
type = types.enum [ "emacs" "emacsclient" ];
|
||||||
|
default = null;
|
||||||
|
example = "emacsclient";
|
||||||
|
description = "Whether to change the EDITOR environment variable or not";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
copyConfigFiles = {
|
||||||
|
enable = mkOption rec {
|
||||||
|
type = types.bool;
|
||||||
|
default = false;
|
||||||
|
example = !default;
|
||||||
|
description = "Whether to copy the config files to ~/.emacs.d or not";
|
||||||
|
};
|
||||||
|
files = mkOption rec {
|
||||||
|
type = types.attrsOf types.path;
|
||||||
|
default = { };
|
||||||
|
example = { "init.el" = ./init.el; };
|
||||||
|
description = "What files to copy under what name";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable (mkMerge [
|
||||||
|
{
|
||||||
|
assertions = [
|
||||||
|
(lib.hm.assertions.assertPlatform "services.emacs" pkgs
|
||||||
|
lib.platforms.linux)
|
||||||
|
{
|
||||||
|
assertion = cfg.defaultEditor.enable -> cfg.defaultEditor.editor != null;
|
||||||
|
message = ''
|
||||||
|
services.baremacs.defaultEditor.enable requires services.baremacs.defaultEditor.editor to be set
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
systemd.user.services.emacs = {
|
||||||
|
Unit = {
|
||||||
|
Description = "Emacs text editor";
|
||||||
|
Documentation =
|
||||||
|
"info:emacs man:emacs(1) https://gnu.org/software/emacs/";
|
||||||
|
|
||||||
|
# Avoid killing the Emacs session, which may be full of
|
||||||
|
# unsaved buffers.
|
||||||
|
X-RestartIfChanged = false;
|
||||||
|
} // optionalAttrs (cfg.socketActivation.enable) {
|
||||||
|
# Emacs deletes its socket when shutting down, which systemd doesn't
|
||||||
|
# handle, resulting in a server without a socket.
|
||||||
|
# See https://github.com/nix-community/home-manager/issues/2018
|
||||||
|
RefuseManualStart = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
Service = {
|
||||||
|
Type = "notify";
|
||||||
|
|
||||||
|
# We wrap ExecStart in a login shell so Emacs starts with the user's
|
||||||
|
# environment, most importantly $PATH and $NIX_PROFILES. It may be
|
||||||
|
# worth investigating a more targeted approach for user services to
|
||||||
|
# iport the user environment.
|
||||||
|
ExecStart = ''
|
||||||
|
${pkgs.runtimeShell} -l -c "${emacsBinPath}/emacs --fg-daemon${
|
||||||
|
# In case the user sets 'server-directory' or 'server-name' in
|
||||||
|
# their Emacs config, we want to specify the socket path explicitly
|
||||||
|
# so launching 'emacs.service' manually doesn't break emacsclient
|
||||||
|
# when using socket activation.
|
||||||
|
optionalString cfg.socketActivation.enable
|
||||||
|
"=${escapeShellArg socketPath}"
|
||||||
|
}"'';
|
||||||
|
|
||||||
|
# Emacs will exit with status 15 after having received SIGTERM, which
|
||||||
|
# is the default "KillSignal" value systemd uses to stop services.
|
||||||
|
SuccessExitStatus = 15;
|
||||||
|
|
||||||
|
Restart = "on-failure";
|
||||||
|
} // optionalAttrs (cfg.socketActivation.enable) {
|
||||||
|
# Use read-only directory permissions to prevent emacs from
|
||||||
|
# deleting systemd's socket file before exiting.
|
||||||
|
ExecStartPost =
|
||||||
|
"${pkgs.coreutils}/bin/chmod --changes -w ${socketDir}";
|
||||||
|
ExecStopPost =
|
||||||
|
"${pkgs.coreutils}/bin/chmod --changes +w ${socketDir}";
|
||||||
|
};
|
||||||
|
} // optionalAttrs (!cfg.socketActivation.enable) {
|
||||||
|
Install = { WantedBy = [ "default.target" ]; };
|
||||||
|
};
|
||||||
|
|
||||||
|
home = {
|
||||||
|
sessionVariables = mkIf cfg.defaultEditor.enable {
|
||||||
|
EDITOR = let editor = cfg.defaultEditor.editor; in
|
||||||
|
getBin (pkgs.writeShellScript "editor" ''
|
||||||
|
exec ${
|
||||||
|
getBin cfg.package
|
||||||
|
}/bin/'' + editor + head (optional (editor == "emacsclient") '' "''${@:---create-frame}"''));
|
||||||
|
};
|
||||||
|
|
||||||
|
file = mkIf cfg.copyConfigFiles.enable
|
||||||
|
(mapAttrs'
|
||||||
|
(n: v:
|
||||||
|
attrsets.nameValuePair (".emacs.d/" + n) { source = v; })
|
||||||
|
cfg.copyConfigFiles.files);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
(mkIf cfg.socketActivation.enable {
|
||||||
|
systemd.user.sockets.emacs = {
|
||||||
|
Unit = {
|
||||||
|
Description = "Emacs text editor";
|
||||||
|
Documentation =
|
||||||
|
"info:emacs man:emacs(1) https://gnu.org/software/emacs/";
|
||||||
|
};
|
||||||
|
|
||||||
|
Socket = {
|
||||||
|
ListenStream = socketPath;
|
||||||
|
FileDescriptorName = "server";
|
||||||
|
SocketMode = "0600";
|
||||||
|
DirectoryMode = "0700";
|
||||||
|
};
|
||||||
|
Install = { WantedBy = [ "sockets.target" ]; };
|
||||||
|
};
|
||||||
|
})
|
||||||
|
]);
|
||||||
|
}
|
@@ -1 +1 @@
|
|||||||
../../../modules/emacs/init.el
|
../../../../overlays/emacs/init.el
|
@@ -1,9 +1,21 @@
|
|||||||
{config, pkgs, ...}:
|
{ config, pkgs, ... }:
|
||||||
let
|
let
|
||||||
home = config.home.homeDirectory;
|
home = config.home.homeDirectory;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
services = {
|
services = {
|
||||||
|
baremacs = {
|
||||||
|
enable = true;
|
||||||
|
package = pkgs.mymacs;
|
||||||
|
defaultEditor = {
|
||||||
|
enable = true;
|
||||||
|
editor = "emacsclient";
|
||||||
|
};
|
||||||
|
copyConfigFiles = {
|
||||||
|
enable = true;
|
||||||
|
files = { "init.el" = ./config/emacs/init.el; };
|
||||||
|
};
|
||||||
|
};
|
||||||
picom = {
|
picom = {
|
||||||
experimentalBackends = true;
|
experimentalBackends = true;
|
||||||
enable = true;
|
enable = true;
|
||||||
@@ -98,4 +110,4 @@ in
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@@ -55,6 +55,12 @@
|
|||||||
fcitx.engines = with pkgs.fcitx-engines; [ m17n mozc ];
|
fcitx.engines = with pkgs.fcitx-engines; [ m17n mozc ];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
virtualisation.docker.enable = true;
|
virtualisation = {
|
||||||
|
docker.enable = true;
|
||||||
|
podman = {
|
||||||
|
enable = true;
|
||||||
|
enableNvidia = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
gtk.iconCache.enable = true;
|
gtk.iconCache.enable = true;
|
||||||
}
|
}
|
||||||
|
@@ -1,65 +0,0 @@
|
|||||||
{ pkgs, ... }:
|
|
||||||
{
|
|
||||||
services.emacs = {
|
|
||||||
enable = true;
|
|
||||||
package = with pkgs; emacsWithPackagesFromUsePackage {
|
|
||||||
config = ./init.el;
|
|
||||||
package = emacsGcc;
|
|
||||||
alwaysEnsure = true;
|
|
||||||
extraEmacsPackages = epkgs: with epkgs; [
|
|
||||||
use-package
|
|
||||||
tsc
|
|
||||||
];
|
|
||||||
#https://github.com/NixOS/nixpkgs/issues/108089
|
|
||||||
override = epkgs: epkgs // {
|
|
||||||
tsc = epkgs.melpaPackages.tsc.overrideAttrs (oa:
|
|
||||||
let
|
|
||||||
version = "0.18.0";
|
|
||||||
tsc-dyn = fetchurl {
|
|
||||||
url = "https://github.com/emacs-tree-sitter/elisp-tree-sitter/releases/download/${version}/tsc-dyn.so";
|
|
||||||
sha256 = "sha256-97KDzdYNJN4ceJeuQxZtQ/7iU0CYXEp6gcSM9rNwlyE=";
|
|
||||||
};
|
|
||||||
in
|
|
||||||
{
|
|
||||||
postInstall = ''
|
|
||||||
cp ${tsc-dyn} $out/share/emacs/site-lisp/elpa/tsc-${oa.version}/tsc-dyn.so
|
|
||||||
echo -n ${version} > $out/share/emacs/site-lisp/elpa/tsc-${oa.version}/DYN-VERSION
|
|
||||||
'';
|
|
||||||
});
|
|
||||||
tree-sitter-langs = epkgs.melpaPackages.tree-sitter-langs.overrideAttrs (oa:
|
|
||||||
let
|
|
||||||
version = "0.11.3";
|
|
||||||
tree-sitter-grammars = super.stdenv.mkDerivation rec {
|
|
||||||
inherit version;
|
|
||||||
name = "tree-sitter-grammars";
|
|
||||||
src = fetchzip {
|
|
||||||
url = "https://github.com/emacs-tree-sitter/tree-sitter-langs/releases/download/${version}/tree-sitter-grammars-linux-${version}.tar.gz";
|
|
||||||
sha256 = "sha256-85Yy6NuEVnibehmalz2qr0pCENYwmxsyyIf0TUYnDY8=";
|
|
||||||
stripRoot = false;
|
|
||||||
};
|
|
||||||
installPhase = ''
|
|
||||||
install -d $out/langs/bin
|
|
||||||
echo -n "${version}" > $out/langs/bin/BUNDLE-VERSION
|
|
||||||
install -m444 * $out/langs/bin
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
in
|
|
||||||
{
|
|
||||||
src = fetchFromGitHub {
|
|
||||||
owner = "emacs-tree-sitter";
|
|
||||||
repo = "tree-sitter-langs";
|
|
||||||
rev = version;
|
|
||||||
sha256 = "sha256-Br+ON7a8FWoU75ySPSP2DkiyHjj80TP5XvcMMJrU9+k=";
|
|
||||||
};
|
|
||||||
postPatch = ''
|
|
||||||
substituteInPlace ./tree-sitter-langs-build.el \
|
|
||||||
--replace "tree-sitter-langs-grammar-dir tree-sitter-langs--dir" "tree-sitter-langs-grammar-dir \"${tree-sitter-grammars}/langs\""
|
|
||||||
'';
|
|
||||||
});
|
|
||||||
gruvbox-theme = epkgs.melpaPackages.gruvbox-theme.overrideAttrs (_: { patches = [ ./gruvbox-el.patch ]; });
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
59
overlays/emacs/default.nix
Normal file
59
overlays/emacs/default.nix
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
{ emacsWithPackagesFromUsePackage, stdenv, fetchzip, fetchurl, fetchFromGitHub, emacsGcc, ... }:
|
||||||
|
|
||||||
|
emacsWithPackagesFromUsePackage {
|
||||||
|
config = ./init.el;
|
||||||
|
package = emacsGcc;
|
||||||
|
alwaysEnsure = true;
|
||||||
|
extraEmacsPackages = epkgs: with epkgs; [
|
||||||
|
use-package
|
||||||
|
tsc
|
||||||
|
];
|
||||||
|
#https://github.com/NixOS/nixpkgs/issues/108089
|
||||||
|
override = epkgs: epkgs // {
|
||||||
|
tsc = epkgs.melpaPackages.tsc.overrideAttrs (oa:
|
||||||
|
let
|
||||||
|
version = "0.18.0";
|
||||||
|
tsc-dyn = fetchurl {
|
||||||
|
url = "https://github.com/emacs-tree-sitter/elisp-tree-sitter/releases/download/${version}/tsc-dyn.so";
|
||||||
|
sha256 = "sha256-97KDzdYNJN4ceJeuQxZtQ/7iU0CYXEp6gcSM9rNwlyE=";
|
||||||
|
};
|
||||||
|
in
|
||||||
|
{
|
||||||
|
postInstall = ''
|
||||||
|
cp ${tsc-dyn} $out/share/emacs/site-lisp/elpa/tsc-${oa.version}/tsc-dyn.so
|
||||||
|
echo -n ${version} > $out/share/emacs/site-lisp/elpa/tsc-${oa.version}/DYN-VERSION
|
||||||
|
'';
|
||||||
|
});
|
||||||
|
tree-sitter-langs = epkgs.melpaPackages.tree-sitter-langs.overrideAttrs (oa:
|
||||||
|
let
|
||||||
|
version = "0.11.3";
|
||||||
|
tree-sitter-grammars = stdenv.mkDerivation rec {
|
||||||
|
inherit version;
|
||||||
|
name = "tree-sitter-grammars";
|
||||||
|
src = fetchzip {
|
||||||
|
url = "https://github.com/emacs-tree-sitter/tree-sitter-langs/releases/download/${version}/tree-sitter-grammars-linux-${version}.tar.gz";
|
||||||
|
sha256 = "sha256-85Yy6NuEVnibehmalz2qr0pCENYwmxsyyIf0TUYnDY8=";
|
||||||
|
stripRoot = false;
|
||||||
|
};
|
||||||
|
installPhase = ''
|
||||||
|
install -d $out/langs/bin
|
||||||
|
echo -n "${version}" > $out/langs/bin/BUNDLE-VERSION
|
||||||
|
install -m444 * $out/langs/bin
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
in
|
||||||
|
{
|
||||||
|
src = fetchFromGitHub {
|
||||||
|
owner = "emacs-tree-sitter";
|
||||||
|
repo = "tree-sitter-langs";
|
||||||
|
rev = version;
|
||||||
|
sha256 = "sha256-Br+ON7a8FWoU75ySPSP2DkiyHjj80TP5XvcMMJrU9+k=";
|
||||||
|
};
|
||||||
|
postPatch = ''
|
||||||
|
substituteInPlace ./tree-sitter-langs-build.el \
|
||||||
|
--replace "tree-sitter-langs-grammar-dir tree-sitter-langs--dir" "tree-sitter-langs-grammar-dir \"${tree-sitter-grammars}/langs\""
|
||||||
|
'';
|
||||||
|
});
|
||||||
|
gruvbox-theme = epkgs.melpaPackages.gruvbox-theme.overrideAttrs (_: { patches = [ ./gruvbox-el.patch ]; });
|
||||||
|
};
|
||||||
|
}
|
@@ -2,4 +2,5 @@ final: prev: {
|
|||||||
mpd_discord_richpresence = prev.callPackage ./mpd-rpc {};
|
mpd_discord_richpresence = prev.callPackage ./mpd-rpc {};
|
||||||
customscripts = prev.callPackage ./customscripts {};
|
customscripts = prev.callPackage ./customscripts {};
|
||||||
gruvbox-icons = prev.callPackage ./gruvbox-icons {};
|
gruvbox-icons = prev.callPackage ./gruvbox-icons {};
|
||||||
|
mymacs = prev.callPackage ./emacs {};
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user