Skip to content

Commit

Permalink
feat(nix): install shell completions and man page (#630)
Browse files Browse the repository at this point in the history
* feat(nix): added nix workflow
* feat(nix): install shell completions and man page
  • Loading branch information
pamburus authored Dec 25, 2024
1 parent ff0e512 commit e4526a9
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 32 deletions.
33 changes: 31 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: CI
name: ci

on:
push:
Expand All @@ -10,7 +10,7 @@ env:
CARGO_TERM_COLOR: always

jobs:
build:
test:
runs-on: ubuntu-latest

steps:
Expand Down Expand Up @@ -54,3 +54,32 @@ jobs:

- name: Run executable
run: cargo run

coverage:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Generate code coverage
run: |
make coverage
- name: Upload coverage to codecov.io
uses: codecov/codecov-action@v4
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

test-nix:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v30

- name: Run nix flake check
run: nix flake check --print-build-logs

- name: Run nix build
run: nix build --print-build-logs
25 changes: 0 additions & 25 deletions .github/workflows/coverage.yml

This file was deleted.

2 changes: 1 addition & 1 deletion Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ members = [".", "crate/encstr"]
[workspace.package]
repository = "https://github.com/pamburus/hl"
authors = ["Pavel Ivanov <[email protected]>"]
version = "0.30.1-alpha.2"
version = "0.30.1-alpha.3"
edition = "2021"
license = "MIT"

Expand Down
21 changes: 18 additions & 3 deletions nix/package.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{ lib
, rustPlatform
,
{
lib,
stdenv,
rustPlatform,
installShellFiles,
}:
let
cargoToml = builtins.fromTOML (builtins.readFile ../Cargo.toml);
Expand All @@ -21,6 +23,19 @@ rustPlatform.buildRustPackage {
};
};

nativeBuildInputs = [ installShellFiles ];

postInstall = ''
installShellCompletion --cmd hl \
--bash <($out/bin/hl --shell-completions bash) \
--fish <($out/bin/hl --shell-completions fish) \
--zsh <($out/bin/hl --shell-completions zsh)
$out/bin/hl --man-page >hl.1
installManPage hl.1
'';

doCheck = false;

meta = {
description = cargoToml.package.description;
homepage = cargoToml.workspace.package.repository;
Expand Down

0 comments on commit e4526a9

Please sign in to comment.