Skip to content

Commit

Permalink
don't use runtimeEnv, update workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
willruggiano committed Mar 13, 2024
1 parent f114348 commit 2c4fb98
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 20 deletions.
10 changes: 3 additions & 7 deletions .github/workflows/check.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
name: Build example and run tests
name: Build and test example flake

on:
pull_request:
push:
branches:
- main

jobs:
tests:
check-pr:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v25
with:
github_access_token: ${{ secrets.GITHUB_TOKEN }}
- run: nix build ./example
- run: nix run ./example#test
- run: nix run .#check-local
3 changes: 2 additions & 1 deletion .github/workflows/update-example.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Update example flake
name: Update, build and test example flake

on:
push:
Expand All @@ -17,6 +17,7 @@ jobs:
with:
github_access_token: ${{ secrets.GITHUB_TOKEN }}
- run: nix flake lock --update-input neovim-nix ./example
- run: nix run .#check
- run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email '[email protected]'
Expand Down
15 changes: 15 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,21 @@
system,
...
}: {
apps = {
check.program = pkgs.writeShellApplication {
name = "check";
text = ''
nix run ./example#test
'';
};
check-local.program = pkgs.writeShellApplication {
name = "check-local";
text = ''
nix run --override-input neovim-nix path:./. ./example#test
'';
};
};

devShells.default = pkgs.mkShell {
name = "neovim.nix";
shellHook = ''
Expand Down
23 changes: 11 additions & 12 deletions modules/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
...
}: let
inherit (flake-parts-lib) mkPerSystemOption;
inherit (lib) makeBinPath mkOption types unique;
inherit (lib) concatStringsSep makeBinPath mapAttrsToList mkOption optional optionals types unique;

mkNeovimEnv = {
config,
Expand All @@ -15,19 +15,18 @@
in
pkgs.writeShellApplication {
name = "nvim";
runtimeEnv =
(cfg.env or {})
// {
NVIM_RPLUGIN_MANIFEST = "${config.neovim.build.rplugin}/rplugin.vim";
};
text =
lib.optionalString (cfg.paths != [])
''
text = concatStringsSep "\n" (
optionals (cfg.env != {}) (mapAttrsToList (name: value: ''export ${name}="''${${name}:-${toString value}}"'') cfg.env)
++ optional (cfg.paths != []) ''
export PATH="$PATH:${makeBinPath (unique cfg.paths)}"
''
+ ''
${cfg.package}/bin/nvim -u ${cfg.build.initlua} "$@"
'';
++ [
''
export NVIM_RPLUGIN_MANIFEST="${config.neovim.build.rplugin}/rplugin.vim"
${cfg.package}/bin/nvim -u ${cfg.build.initlua} "$@"
''
]
);
derivationArgs.passthru = {
inherit (config.neovim.build) initlua plugins;
};
Expand Down

0 comments on commit 2c4fb98

Please sign in to comment.