-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from nvim-neorocks/flake
build: add nix dev + build environment + ci builds
- Loading branch information
Showing
6 changed files
with
312 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
use flake . -Lv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
--- | ||
name: "Nix build" | ||
on: | ||
pull_request: | ||
push: | ||
branches: [ master ] | ||
jobs: | ||
build: | ||
name: ${{ matrix.attribute }} / ${{ matrix.os }} | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: | ||
- ubuntu-latest | ||
attribute: | ||
- .#devShells.x86_64-linux.default | ||
- .#packages.x86_64-linux.rocks | ||
- .#checks.x86_64-linux.pre-commit-check | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: DeterminateSystems/nix-installer-action@v9 | ||
- uses: cachix/cachix-action@v14 | ||
with: | ||
name: neorocks | ||
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' | ||
# Some of the tests query luarocks.org. TODO: Get sandboxed tests working | ||
- run: nix build "${{matrix.attribute}}" --option sandbox false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
zig-out | ||
zig-cache | ||
|
||
.direnv | ||
|
||
# Added by cargo | ||
|
||
/target | ||
|
||
# Added by nix | ||
|
||
/result |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
{ | ||
description = "Luarocks <3 Rust"; | ||
|
||
inputs = { | ||
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; | ||
flake-parts.url = "github:hercules-ci/flake-parts"; | ||
pre-commit-hooks = { | ||
url = "github:cachix/pre-commit-hooks.nix"; | ||
inputs.nixpkgs.follows = "nixpkgs"; | ||
}; | ||
}; | ||
|
||
outputs = inputs @ { | ||
self, | ||
nixpkgs, | ||
flake-parts, | ||
pre-commit-hooks, | ||
... | ||
}: let | ||
overlay = import ./nix/overlay.nix {inherit self;}; | ||
in | ||
flake-parts.lib.mkFlake {inherit inputs;} { | ||
systems = [ | ||
"x86_64-linux" | ||
"x86_64-darwin" | ||
"aarch64-darwin" | ||
]; | ||
perSystem = { | ||
config, | ||
self', | ||
inputs', | ||
pkgs, | ||
system, | ||
... | ||
}: let | ||
pkgs = import nixpkgs { | ||
inherit system; | ||
overlays = [ | ||
overlay | ||
]; | ||
}; | ||
pre-commit-check = pre-commit-hooks.lib.${system}.run { | ||
src = self; | ||
hooks = { | ||
alejandra.enable = true; | ||
rustfmt.enable = true; | ||
}; | ||
}; | ||
in { | ||
packages = with pkgs; { | ||
default = rocks; | ||
inherit rocks; | ||
}; | ||
|
||
devShells.default = pkgs.mkShell { | ||
name = "rocks devShell"; | ||
inherit (pre-commit-check) shellHook; | ||
buildInputs = | ||
(with pkgs; [ | ||
rust-analyzer | ||
]) | ||
++ (with pre-commit-hooks.packages.${system}; [ | ||
alejandra | ||
rustfmt | ||
]) | ||
++ pkgs.rocks.buildInputs | ||
++ pkgs.rocks.nativeBuildInputs; | ||
}; | ||
|
||
checks = with pkgs; { | ||
inherit | ||
pre-commit-check | ||
rocks | ||
; | ||
}; | ||
}; | ||
flake = { | ||
overlays.default = overlay; | ||
}; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{self}: final: prev: { | ||
rocks = with final; | ||
rustPlatform.buildRustPackage { | ||
pname = "rocks"; | ||
version = ((lib.importTOML "${self}/rocks-bin/Cargo.toml").package).version; | ||
|
||
src = self; | ||
|
||
cargoLock = { | ||
lockFile = ../Cargo.lock; | ||
}; | ||
|
||
nativeBuildInputs = [ | ||
pkg-config | ||
]; | ||
|
||
buildInputs = [ | ||
luajit | ||
openssl | ||
]; | ||
}; | ||
} |