Instantiate template + ripgrep-all package

This commit is contained in:
FliegendeWurst 2022-05-25 11:31:14 +02:00
parent ce8ce4786d
commit 9983c5385a
7 changed files with 83 additions and 94 deletions

View File

@ -6,10 +6,10 @@ on:
- main - main
- master - master
schedule: schedule:
# rebuild everyday at 2:51 # rebuild everyday at 4:55
# TIP: Choose a random time here so not all repositories are build at once: # TIP: Choose a random time here so not all repositories are build at once:
# https://www.random.org/clock-times/?num=1&earliest=01%3A00&latest=08%3A00&interval=5&format=html&rnd=new # https://www.random.org/clock-times/?num=1&earliest=01%3A00&latest=08%3A00&interval=5&format=html&rnd=new
- cron: '51 2 * * *' - cron: '55 4 * * *'
jobs: jobs:
tests: tests:
strategy: strategy:
@ -20,7 +20,7 @@ jobs:
# The repo name as used in # The repo name as used in
# https://github.com/nix-community/NUR/blob/master/repos.json # https://github.com/nix-community/NUR/blob/master/repos.json
nurRepo: nurRepo:
- <YOUR_REPO_NAME> - 'fliegendewurst'
# Set this to cache your build results in cachix for faster builds # Set this to cache your build results in cachix for faster builds
# in CI and for everyone who uses your cache. # in CI and for everyone who uses your cache.
# #
@ -31,8 +31,8 @@ jobs:
# CACHIX_AUTH_TOKEN secret in your repository secrets settings in # CACHIX_AUTH_TOKEN secret in your repository secrets settings in
# Github found at # Github found at
# https://github.com/<your_githubname>/nur-packages/settings/secrets # https://github.com/<your_githubname>/nur-packages/settings/secrets
cachixName: #cachixName:
- <YOUR_CACHIX_NAME> # - <YOUR_CACHIX_NAME>
nixPath: nixPath:
- nixpkgs=channel:nixos-unstable - nixpkgs=channel:nixos-unstable
- nixpkgs=channel:nixpkgs-unstable - nixpkgs=channel:nixpkgs-unstable
@ -53,14 +53,14 @@ jobs:
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
- name: Show nixpkgs version - name: Show nixpkgs version
run: nix-instantiate --eval -E '(import <nixpkgs> {}).lib.version' run: nix-instantiate --eval -E '(import <nixpkgs> {}).lib.version'
- name: Setup cachix #- name: Setup cachix
uses: cachix/cachix-action@v10 # uses: cachix/cachix-action@v10
# Don't replace <YOUR_CACHIX_NAME> here! # # Don't replace <YOUR_CACHIX_NAME> here!
if: ${{ matrix.cachixName != '<YOUR_CACHIX_NAME>' }} # if: ${{ matrix.cachixName != '<YOUR_CACHIX_NAME>' }}
with: # with:
name: ${{ matrix.cachixName }} # name: ${{ matrix.cachixName }}
signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}' # signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}'
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' # authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- name: Check evaluation - name: Check evaluation
run: | run: |
nix-env -f . -qa \* --meta --xml \ nix-env -f . -qa \* --meta --xml \

View File

@ -1,40 +0,0 @@
version: ~> 1.0
import: nix-community/nix-travis-ci:nix.yml@main
sudo: false
env:
global:
# Set this to cache your build results in cachix for faster builds
# in travis and for everyone who uses your cache.
#
# Format: Your cachix cache host name without the ".cachix.org" suffix.
# Example: mycache (for mycache.cachix.org)
#
# For this to work, you also need to set the CACHIX_SIGNING_KEY
# in your repository settings in Travis.
# - CACHIX_CACHE=
# Set this to notify the global nur package registry that changes are
# available.
#
# The repo name as used in
# https://github.com/nix-community/NUR/blob/master/repos.json
- NUR_REPO="<YOUR_NUR_REPO_NAME_HERE>"
matrix:
include:
- env: NIX_PATH=nixpkgs=channel:nixpkgs-unstable
- env: NIX_PATH=nixpkgs=channel:nixos-unstable
- env: NIX_PATH=nixpkgs=channel:nixos-20.03
script:
- nix-build ci.nix -A buildOutputs
- nix eval -f default.nix 'lib'
- nix eval -f default.nix 'modules'
- nix eval -f default.nix 'overlays'
after_success:
- if [ -n "${CACHIX_CACHE}" ]; then nix-build ci.nix -A cacheOutputs | cachix push "${CACHIX_CACHE}"; fi
- if [[ NUR_REPO != "<YOUR_NUR_REPO_NAME_HERE>" && "cron" != "${TRAVIS_EVENT_TYPE}" && "false" = "${TRAVIS_PULL_REQUEST}" && "master" = "${TRAVIS_BRANCH}" ]]; then
curl -XPOST "https://nur-update.herokuapp.com/update?repo=${NUR_REPO}"; fi

View File

@ -1,6 +1,6 @@
MIT License MIT License
Copyright (c) 2018 Francesco Gazzetta Copyright (c) 2018 Francesco Gazzetta, Arne Keller
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

View File

@ -1,37 +1,9 @@
# nur-packages-template
**A template for [NUR](https://github.com/nix-community/NUR) repositories**
## Setup
1. Click on [Use this template](https://github.com/nix-community/nur-packages-template/generate) to start a repo based on this template. (Do _not_ fork it.)
2. Add your packages to the [pkgs](./pkgs) directory and to
[default.nix](./default.nix)
* Remember to mark the broken packages as `broken = true;` in the `meta`
attribute, or travis (and consequently caching) will fail!
* Library functions, modules and overlays go in the respective directories
3. Choose your CI: Depending on your preference you can use github actions (recommended) or [Travis ci](https://travis-ci.com).
- Github actions: Change your NUR repo name and optionally add a cachix name in [.github/workflows/build.yml](./.github/workflows/build.yml) and change the cron timer
to a random value as described in the file
- Travis ci: Change your NUR repo name and optionally your cachix repo name in
[.travis.yml](./.travis.yml). Than enable travis in your repo. You can add a cron job in the repository settings on travis to keep your cachix cache fresh
5. Change your travis and cachix names on the README template section and delete
the rest
6. [Add yourself to NUR](https://github.com/nix-community/NUR#how-to-add-your-own-repository)
## README template
# nur-packages # nur-packages
**My personal [NUR](https://github.com/nix-community/NUR) repository** **My personal [NUR](https://github.com/nix-community/NUR) repository**
<!-- Remove this if you don't use github actions --> ![Build and populate cache](https://github.com/FliegendeWurst/nur-packages/workflows/Build%20and%20populate%20cache/badge.svg)
![Build and populate cache](https://github.com/<YOUR-GITHUB-USER>/nur-packages/workflows/Build%20and%20populate%20cache/badge.svg)
<!-- <!--
Uncomment this if you use travis:
[![Build Status](https://travis-ci.com/<YOUR_TRAVIS_USERNAME>/nur-packages.svg?branch=master)](https://travis-ci.com/<YOUR_TRAVIS_USERNAME>/nur-packages)
-->
[![Cachix Cache](https://img.shields.io/badge/cachix-<YOUR_CACHIX_CACHE_NAME>-blue.svg)](https://<YOUR_CACHIX_CACHE_NAME>.cachix.org) [![Cachix Cache](https://img.shields.io/badge/cachix-<YOUR_CACHIX_CACHE_NAME>-blue.svg)](https://<YOUR_CACHIX_CACHE_NAME>.cachix.org)
-->

View File

@ -14,7 +14,9 @@
modules = import ./modules; # NixOS modules modules = import ./modules; # NixOS modules
overlays = import ./overlays; # nixpkgs overlays overlays = import ./overlays; # nixpkgs overlays
example-package = pkgs.callPackage ./pkgs/example-package { }; ripgrep-all = pkgs.callPackage ./pkgs/ripgrep-all {
inherit (pkgs.darwin.apple_sdk.frameworks) Security;
};
# some-qt5-package = pkgs.libsForQt5.callPackage ./pkgs/some-qt5-package { }; # some-qt5-package = pkgs.libsForQt5.callPackage ./pkgs/some-qt5-package { };
# ... # ...
} }

View File

@ -1,9 +0,0 @@
{ stdenv }:
stdenv.mkDerivation rec {
name = "example-package-${version}";
version = "1.0";
src = ./.;
buildPhase = "echo echo Hello World > example";
installPhase = "install -Dm755 example $out";
}

View File

@ -0,0 +1,64 @@
{ stdenv, lib, fetchFromGitHub, rustPlatform, makeWrapper
, pandoc, poppler_utils, ripgrep, Security
}:
rustPlatform.buildRustPackage rec {
pname = "ripgrep-all";
version = "0.9.7-infdev";
src = fetchFromGitHub {
owner = "FliegendeWurst";
repo = pname;
rev = "ca0191c38ed0c3ef6dc733bd3c4d4359ff4fb522";
sha256 = "0fkkpk82bd9bm184nmcx6vn1pqwc9z0abr6wsfr6vkd6vm3184ca";
};
cargoSha256 = "1z1008yyhzch92740bcs4mn5l0b2y7z3h2vjp5vh2qk99byh6ydm";
nativeBuildInputs = [ makeWrapper ];
buildInputs = lib.optional stdenv.isDarwin Security;
postInstall = ''
wrapProgram $out/bin/rga \
--prefix PATH ":" "${lib.makeBinPath [ pandoc poppler_utils ripgrep ]}"
'';
# Use upstream's example data to run a couple of queries to ensure the dependencies
# for all of the adapters are available.
installCheckPhase = ''
set -e
export PATH="$PATH:$out/bin"
test1=$(rga --rga-no-cache "hello" exampledir/ | wc -l)
test2=$(rga --rga-no-cache --rga-adapters=tesseract "crate" exampledir/screenshot.png | wc -l)
if [ $test1 != 26 ]
then
echo "ERROR: test1 failed! Could not find the word 'hello' 26 times in the sample data."
exit 1
fi
if [ $test2 != 1 ]
then
echo "ERROR: test2 failed! Could not find the word 'crate' in the screenshot."
exit 1
fi
'';
doInstallCheck = false;
doCheck = false; # ...
meta = with lib; {
description = "Ripgrep, but also search in PDFs, E-Books, Office documents, zip, tar.gz, and more";
longDescription = ''
Ripgrep, but also search in PDFs, E-Books, Office documents, zip, tar.gz, etc.
rga is a line-oriented search tool that allows you to look for a regex in
a multitude of file types. rga wraps the awesome ripgrep and enables it
to search in pdf, docx, sqlite, jpg, movie subtitles (mkv, mp4), etc.
'';
homepage = "https://github.com/phiresky/ripgrep-all";
license = with licenses; [ agpl3Plus ];
maintainers = with maintainers; [ fliegendewurst ];
mainProgram = "rga";
};
}