Skip to content

Commit

Permalink
chore: maybe fix env
Browse files Browse the repository at this point in the history
  • Loading branch information
gilacost committed Sep 2, 2024
1 parent 400e163 commit d1f7840
Show file tree
Hide file tree
Showing 8 changed files with 108 additions and 28 deletions.
16 changes: 8 additions & 8 deletions darwin-configuration.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@
# https://github.com/LnL7/nix-darwin/issues/165
environment.etc = {
"sudoers.d/10-nix-commands".text = ''
%admin ALL=(ALL:ALL) NOPASSWD: /run/current-system/sw/bin/darwin-rebuild, \
/run/current-system/sw/bin/nix*, \
/run/current-system/sw/bin/ln, \
/nix/store/*/activate, \
/bin/launchctl
%admin ALL=(ALL:ALL) NOPASSWD: /run/current-system/sw/bin/*, \
/Users/pepo/.nix-profile/bin/nix, \
/usr/local/bin/*, \
/opt/homebrew/bin/*, \
/nix/store/*/activate, \
/bin/launchctl
'';
};

Expand All @@ -27,8 +28,7 @@
programs.nix-index.enable = true;
programs.zsh.enable = true;

fonts.fontDir.enable = true;
fonts.fonts = with pkgs; [ (nerdfonts.override { fonts = [ "Iosevka" ]; }) ];
fonts.packages = with pkgs; [ (nerdfonts.override { fonts = [ "Iosevka" ]; }) ];

nix = {
configureBuildUsers = true;
Expand Down Expand Up @@ -272,6 +272,7 @@
brews = [ "qemu" "mas" "asciinema" "fwup" "coreutils" "ansible" ];

casks = [
"logitech-presentation"
"postman"
"tableplus"
"arc"
Expand All @@ -286,7 +287,6 @@
"1password"
"OmniGraffle"
"adobe-acrobat-reader"
"discord"
"docker"
"google-chrome"
"google-drive"
Expand Down
30 changes: 15 additions & 15 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions modules/editor/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@
\ }
lua << EOF
vim.g.lsp_elixir_bin = "${pkgs.lexical}/bin/lexical"
${builtins.readFile ./nvim/base.lua}
${builtins.readFile ./nvim/lsp.lua}
Expand All @@ -103,7 +102,7 @@
${builtins.readFile ./nvim/nvim-tree.lua}
EOF
'';

# vim.g.lsp_elixir_bin = "${pkgs.elixir_ls}/bin/elixir-ls"
plugins =
with pkgs;
with pkgs.vimPlugins;
Expand Down
1 change: 1 addition & 0 deletions modules/editor/nvim/lsp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ local border = {

lsp.lexical.setup{
cmd = { vim.g.lsp_elixir_bin },
flags = { debounce_text_changes = 150, },
}

lsp.erlangls.setup {}
Expand Down
2 changes: 1 addition & 1 deletion modules/editor/nvim/nvim-tree.lua
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,4 @@ vim.api.nvim_create_autocmd("BufEnter", {
end
end
})
d,

3 changes: 2 additions & 1 deletion modules/tools/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@

# LSP, LINTING AND FORMATTING
hclfmt
elixir_ls
# elixir_ls
# (callPackage (import ./elixir-ls.nix) {})
erlang-ls
terraform-ls
tailwindcss-language-server
Expand Down
79 changes: 79 additions & 0 deletions modules/tools/elixir-ls.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
{ lib, elixir, fetchFromGitHub, fetchMixDeps, mixRelease, nix-update-script }:

let
pname = "elixir-ls";
version = "0.23.0";
src = fetchFromGitHub {
owner = "elixir-lsp";
repo = "elixir-ls";
rev = "v${version}";
hash = "sha256-X5BJuqr3TVwpv731ym+Ac3+goA0LH9f3H5wWFwQsAB8=";
fetchSubmodules = true;
};
in
mixRelease {
inherit pname version src elixir;

stripDebug = true;

mixFodDeps = fetchMixDeps {
pname = "mix-deps-${pname}";
inherit src version elixir;
hash = "sha256-3PVMembw3CpYUQ/ynoPKmu0N5iZwoFu9uNjRS+kS4BY=";
};

# elixir-ls is an umbrella app
# override configurePhase to not skip umbrella children
configurePhase = ''
runHook preConfigure
mix deps.compile --no-deps-check
runHook postConfigure
'';

# elixir-ls require a special step for release
# compile and release need to be performed together because
# of the no-deps-check requirement
buildPhase = ''
runHook preBuild
mix do compile --no-deps-check, elixir_ls.release${lib.optionalString (lib.versionAtLeast elixir.version "1.16.0") "2"}
runHook postBuild
'';

installPhase = ''
runHook preInstall
mkdir -p $out/bin
cp -Rv release $out/lib
# Prepare the wrapper script
substitute release/language_server.sh $out/bin/elixir-ls \
--replace 'exec "''${dir}/launch.sh"' "exec $out/lib/launch.sh"
chmod +x $out/bin/elixir-ls
substitute release/debug_adapter.sh $out/bin/elixir-debug-adapter \
--replace 'exec "''${dir}/launch.sh"' "exec $out/lib/launch.sh"
chmod +x $out/bin/elixir-debug-adapter
# prepare the launcher
substituteInPlace $out/lib/launch.sh \
--replace "ERL_LIBS=\"\$SCRIPTPATH:\$ERL_LIBS\"" \
"ERL_LIBS=$out/lib:\$ERL_LIBS" \
--replace "exec elixir" "exec ${elixir}/bin/elixir"
runHook postInstall
'';

meta = with lib; {
homepage = "https://github.com/elixir-lsp/elixir-ls";
description = ''
A frontend-independent IDE "smartness" server for Elixir.
Implements the "Language Server Protocol" standard and provides debugger support via the "Debug Adapter Protocol"
'';
longDescription = ''
The Elixir Language Server provides a server that runs in the background, providing IDEs, editors, and other tools with information about Elixir Mix projects.
It adheres to the Language Server Protocol, a standard for frontend-independent IDE support.
Debugger integration is accomplished through the similar VS Code Debug Protocol.
'';
license = licenses.asl20;
platforms = platforms.unix;
mainProgram = "elixir-ls";
maintainers = teams.beam.members;
};
passthru.updateScript = nix-update-script { };
}
2 changes: 1 addition & 1 deletion spell/init.lua

0 comments on commit d1f7840

Please sign in to comment.