Skip to content

Commit

Permalink
feat: add extra_packages input
Browse files Browse the repository at this point in the history
  • Loading branch information
mrcjkb committed Mar 15, 2023
1 parent 61eed1c commit 70e464d
Show file tree
Hide file tree
Showing 9 changed files with 66 additions and 18 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@ jobs:
copy_directories: |
{{ neovim.plugin.dirs }}
bin
extra_packages: |
deno
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Added
- `extra_packages` input for adding additional build dependencies from `nixpkgs`.

## [v3.0.0] - 2023-03-08
### Added
- Add directories from Neovim's `runtimepath` and some common plugin directories
Expand Down
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ FROM nixpkgs/nix-flakes:nixos-22.11 AS luarocks-tag-release


COPY bin /pkg/bin
COPY nix /pkg/nix
COPY luarocks-tag-release-scm-1.rockspec /pkg/
COPY flake.nix /pkg/flake.nix
COPY flake.lock /pkg/flake.lock
Expand Down
20 changes: 18 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,23 @@ Example:
template: "/path/to/my/template.rockspec"
```

### `license` (optional)
### `extra_packages`

List of extra packages from [`nixpkgs`](https://search.nixos.org/packages?channel=unstable)
that can be used for building the LuaRocks package.

Example:

```yaml
- name: LuaRocks Upload
uses: nvim-neorocks/luarocks-tag-release@v3
with:
extra_packages: |
deno
inkscape
```

### `license`

The license used by this package.
If not set (by default), this workflow will fetch the license SPDX ID from GitHub.
Expand All @@ -211,7 +227,7 @@ Example:
> ![about](https://user-images.githubusercontent.com/12857160/218101570-b0605716-0457-47c1-ab2e-91d48a48881c.png)


### `version` (optional)
### `version`

The package version to release to LuaRocks (without the rockspec revision).
By default, this workflow will use the git tag to determine the LuaRocks package version.
Expand Down
6 changes: 6 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ inputs:
options:
- builtin
- make
extra_packages:
description: |
List of extra packages from nixpkgs that can be used for the build.
required: true
default: ""
template:
description: "Path to a rockspec template."
required: true
Expand All @@ -68,6 +73,7 @@ runs:
using: "docker"
image: "Dockerfile"
args:
- ${{ inputs.extra_packages }}
- ${{ inputs.name }}
- ${{ inputs.version }}
- ${{ inputs.dependencies }}
Expand Down
14 changes: 13 additions & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
#!/usr/bin/env bash

set -e

EXTRA_PACKAGES="$1"

while read -r nixpkg; do
NIXPKG="$(echo "$nixpkg" | tr -d '"')" # (why, Bash?)
if [[ "$NIXPKG" != "" ]]; then
echo "Adding extra package: $NIXPKG"
nix run "nixpkgs#gnused" -- "-i" "s/#PLACEHOLDER/$NIXPKG\n #PLACEHOLDER/" "/pkg/nix/extraRuntimeInputs.nix"
fi
done <<<"$EXTRA_PACKAGES"

nix build "/pkg#luarocks-tag-release"

./result/bin/luarocks-tag-release "$@"
./result/bin/luarocks-tag-release "${@:2}"
12 changes: 6 additions & 6 deletions flake.lock

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

21 changes: 12 additions & 9 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,21 @@
luafilesystem
];
};
extraRuntimeInputs = (import ./nix/extraRuntimeInputs.nix pkgs).extraRuntimeInputs;
in
pkgs.writeShellApplication {
name = "luarocks-tag-release";
runtimeInputs = with pkgs; [
curl
gnumake
lua51Packages.dkjson # Used by luarocks
lua51Packages.luarocks
luarocks-tag-release-wrapped
unzip
zip
];
runtimeInputs = with pkgs;
[
curl
gnumake
lua51Packages.dkjson # Used by luarocks
lua51Packages.luarocks
luarocks-tag-release-wrapped
unzip
zip
]
++ extraRuntimeInputs;

text = ''
luarocks-tag-release.lua "$@"
Expand Down
5 changes: 5 additions & 0 deletions nix/extraRuntimeInputs.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pkgs: {
extraRuntimeInputs = with pkgs; [
#PLACEHOLDER
];
}

0 comments on commit 70e464d

Please sign in to comment.