Merge pull request #223 from lafrenierejm/nix-flake-update

Update Cargo dependencies to patch known vulnerabilities
pull/228/head
phiresky 3 weeks ago committed by GitHub
commit b7f410edbd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

602
Cargo.lock generated

File diff suppressed because it is too large Load Diff

@ -3,11 +3,11 @@
"advisory-db": {
"flake": false,
"locked": {
"lastModified": 1705203771,
"narHash": "sha256-2SApzyw9lm1Dfq+mxLf6JsEVb1hJ5pwR5osd58dj0aQ=",
"lastModified": 1714183630,
"narHash": "sha256-1BVft7ggSN2XXFeXQjazU3jN9wVECd9qp2mZx/8GDMk=",
"owner": "rustsec",
"repo": "advisory-db",
"rev": "826f71c4027a6db6ecf870fdd541814041fc8e1e",
"rev": "35e7459a331d3e0c585e56dabd03006b9b354088",
"type": "github"
},
"original": {
@ -23,11 +23,11 @@
]
},
"locked": {
"lastModified": 1704819371,
"narHash": "sha256-oFUfPWrWGQTZaCM3byxwYwrMLwshDxVGOrMH5cVP/X8=",
"lastModified": 1714864355,
"narHash": "sha256-uXNW6bapWFfkYIkK1EagydSrFMqycOYEDSq75GmUpjk=",
"owner": "ipetkov",
"repo": "crane",
"rev": "5c234301a1277e4cc759c23a2a7a00a06ddd7111",
"rev": "442a7a6152f49b907e73206dc8e1f46a61e8e873",
"type": "github"
},
"original": {
@ -57,11 +57,11 @@
"systems": "systems"
},
"locked": {
"lastModified": 1705309234,
"narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=",
"lastModified": 1710146030,
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26",
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
"type": "github"
},
"original": {
@ -78,11 +78,11 @@
]
},
"locked": {
"lastModified": 1703887061,
"narHash": "sha256-gGPa9qWNc6eCXT/+Z5/zMkyYOuRZqeFZBDbopNZQkuY=",
"lastModified": 1709087332,
"narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=",
"owner": "hercules-ci",
"repo": "gitignore.nix",
"rev": "43e1aa1308018f37118e34d3a9cb4f5e75dc11d5",
"rev": "637db329424fd7e46cf4185293b9cc8c88c95394",
"type": "github"
},
"original": {
@ -93,11 +93,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1705358780,
"narHash": "sha256-bhyKNLV2XW1H1QTAqTcqdDiIkWV2lBUHvx3A5lrlG+E=",
"lastModified": 1714957863,
"narHash": "sha256-6L5qGcrUbVf9Jvm4yuvw5Fnav1VYwlWCrKVocK1gM3k=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "005862f60d11a2949b696191d67315b8ee69d8fa",
"rev": "db5f88c41a638e4ff1f67a61310a6e958eaa07a8",
"type": "github"
},
"original": {
@ -108,11 +108,11 @@
},
"nixpkgs-stable": {
"locked": {
"lastModified": 1704874635,
"narHash": "sha256-YWuCrtsty5vVZvu+7BchAxmcYzTMfolSPP5io8+WYCg=",
"lastModified": 1710695816,
"narHash": "sha256-3Eh7fhEID17pv9ZxrPwCLfqXnYP006RKzSs0JptsN84=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "3dc440faeee9e889fe2d1b4d25ad0f430d449356",
"rev": "614b4613980a522ba49f0d194531beddbb7220d3",
"type": "github"
},
"original": {
@ -135,11 +135,11 @@
"nixpkgs-stable": "nixpkgs-stable"
},
"locked": {
"lastModified": 1705229514,
"narHash": "sha256-itILy0zimR/iyUGq5Dgg0fiW8plRDyxF153LWGsg3Cw=",
"lastModified": 1714478972,
"narHash": "sha256-q//cgb52vv81uOuwz1LaXElp3XAe1TqrABXODAEF6Sk=",
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"rev": "ffa9a5b90b0acfaa03b1533b83eaf5dead819a05",
"rev": "2849da033884f54822af194400f8dff435ada242",
"type": "github"
},
"original": {
@ -168,11 +168,11 @@
]
},
"locked": {
"lastModified": 1705285102,
"narHash": "sha256-e7uridAdtZOiUZD7fjrWkUB6qr1HM2thQpDRRgJfLNc=",
"lastModified": 1714961776,
"narHash": "sha256-LiIxWRKbm1DZ+7l1a6FMmIO8leQx5yrRLIApCMai1DY=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "d681ac8a92a1cce066df1d3a5a7f7c909688f4be",
"rev": "f3b20ea4131408ea585bddb1f41f91c4de9499cf",
"type": "github"
},
"original": {

@ -1,6 +1,5 @@
{
description =
"ripgrep, but also search in PDFs, E-Books, Office documents, zip, tar.gz, etc.";
description = "ripgrep, but also search in PDFs, E-Books, Office documents, zip, tar.gz, etc.";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs";
@ -34,105 +33,116 @@
};
};
outputs = { self, nixpkgs, crane, flake-utils, rust-overlay, advisory-db
, pre-commit-hooks }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ (import rust-overlay) ];
};
outputs = {
self,
nixpkgs,
crane,
flake-utils,
rust-overlay,
advisory-db,
pre-commit-hooks,
}:
flake-utils.lib.eachDefaultSystem (system: let
pkgs = import nixpkgs {
inherit system;
overlays = [(import rust-overlay)];
};
craneLib = crane.lib.${system};
src = pkgs.lib.cleanSourceWith {
src = craneLib.path ./.;
filter = pkgs.lib.cleanSourceFilter;
};
craneLib = crane.lib.${system};
src = pkgs.lib.cleanSourceWith {
src = craneLib.path ./.;
filter = pkgs.lib.cleanSourceFilter;
};
nativeBuildInputs = pkgs.lib.optionals pkgs.stdenv.isDarwin [
# Additional darwin specific inputs can be set here
pkgs.libiconv
];
nativeBuildInputs = pkgs.lib.optionals pkgs.stdenv.isDarwin [
# Additional darwin specific inputs can be set here
pkgs.libiconv
];
runtimeInputs = with pkgs; [ ffmpeg pandoc poppler_utils ripgrep zip ];
runtimeInputs = with pkgs; [ffmpeg pandoc poppler_utils ripgrep zip];
# Build *just* the cargo dependencies, so we can reuse
# all of that work (e.g. via cachix) when running in CI
cargoArtifacts =
craneLib.buildDepsOnly { inherit src nativeBuildInputs; };
# Build *just* the cargo dependencies, so we can reuse
# all of that work (e.g. via cachix) when running in CI
cargoArtifacts =
craneLib.buildDepsOnly {inherit src nativeBuildInputs;};
# Build the actual crate itself, reusing the dependency
# artifacts from above.
rgaBinary = craneLib.buildPackage {
inherit cargoArtifacts src nativeBuildInputs;
buildInputs = runtimeInputs; # needed for tests
};
# Build the actual crate itself, reusing the dependency
# artifacts from above.
rgaBinary = craneLib.buildPackage {
inherit cargoArtifacts src nativeBuildInputs;
buildInputs = runtimeInputs; # needed for tests
};
# Provide a shell script of the Rust binary plus runtime dependencies.
rga = pkgs.pkgs.writeShellApplication {
name = "rga";
text = ''rga "$@"'';
runtimeInputs = runtimeInputs ++ [ rgaBinary ];
};
# Provide a shell script of the Rust binary plus runtime dependencies.
rga = pkgs.pkgs.writeShellApplication {
name = "rga";
text = ''rga "$@"'';
runtimeInputs = runtimeInputs ++ [rgaBinary];
};
pre-commit = pre-commit-hooks.lib."${system}".run;
in {
# `nix flake check`
checks = {
# Build the crate as part of `nix flake check` for convenience
inherit rgaBinary;
# Run clippy (and deny all warnings) on the crate source,
# again, resuing the dependency artifacts from above.
#
# Note that this is done as a separate derivation so that
# we can block the CI if there are issues here, but not
# prevent downstream consumers from building our crate by itself.
rga-clippy = craneLib.cargoClippy {
inherit cargoArtifacts src;
cargoClippyExtraArgs = "--all-targets -- --deny warnings";
};
pre-commit = pre-commit-hooks.lib."${system}".run;
in {
# `nix flake check`
checks = {
# Build the crate as part of `nix flake check` for convenience
inherit rgaBinary;
# Run clippy (and deny all warnings) on the crate source,
# again, resuing the dependency artifacts from above.
#
# Note that this is done as a separate derivation so that
# we can block the CI if there are issues here, but not
# prevent downstream consumers from building our crate by itself.
rga-clippy = craneLib.cargoClippy {
inherit cargoArtifacts src;
cargoClippyExtraArgs = "--all-targets -- --deny warnings";
};
rga-doc = craneLib.cargoDoc { inherit cargoArtifacts src; };
rga-doc = craneLib.cargoDoc {inherit cargoArtifacts src;};
# Check formatting
rga-fmt = craneLib.cargoFmt { inherit src; };
# Check formatting
rga-fmt = craneLib.cargoFmt {inherit src;};
# Audit dependencies
rga-audit = craneLib.cargoAudit { inherit src advisory-db; };
# Audit dependencies
rga-audit = craneLib.cargoAudit {inherit src advisory-db;};
# Run tests with cargo-nextest.
rga-nextest = craneLib.cargoNextest {
inherit cargoArtifacts src nativeBuildInputs;
buildInputs = runtimeInputs; # needed for tests
partitions = 1;
partitionType = "count";
};
# Run tests with cargo-nextest.
rga-nextest = craneLib.cargoNextest {
inherit cargoArtifacts src nativeBuildInputs;
buildInputs = runtimeInputs; # needed for tests
partitions = 1;
partitionType = "count";
};
pre-commit = pre-commit {
src = ./.;
hooks = {
nixfmt.enable = true;
rustfmt.enable = true;
typos.enable = true;
pre-commit = pre-commit {
src = ./.;
hooks = {
alejandra.enable = true;
rustfmt.enable = true;
typos = {
enable = true;
settings = {
exclude = "exampledir/*";
};
};
};
};
};
# `nix build`
packages = {
inherit rgaBinary rga;
default = rga; # `nix build`
};
# `nix build`
packages = {
inherit rgaBinary rga;
default = rga; # `nix build`
};
# `nix run`
apps.default = flake-utils.lib.mkApp { drv = rga; };
# `nix run`
apps.default = flake-utils.lib.mkApp {drv = rga;};
# `nix develop`
devShells.default = craneLib.devShell {
inherit (self.checks.${system}.pre-commit) shellHook;
inputsFrom = builtins.attrValues self.checks;
packages = runtimeInputs ++ nativeBuildInputs;
};
});
# `nix develop`
devShells.default = craneLib.devShell {
inherit (self.checks.${system}.pre-commit) shellHook;
inputsFrom = builtins.attrValues self.checks;
packages = runtimeInputs ++ nativeBuildInputs;
};
});
}

@ -149,7 +149,7 @@ pub fn get_all_adapters(custom_adapters: Option<Vec<CustomAdapterConfig>>) -> Ad
*/
pub fn get_adapters_filtered<T: AsRef<str>>(
custom_adapters: Option<Vec<CustomAdapterConfig>>,
adapter_names: &Vec<T>,
adapter_names: &[T],
) -> Result<Vec<Arc<dyn FileAdapter>>> {
let (def_enabled_adapters, def_disabled_adapters) = get_all_adapters(custom_adapters);
let adapters = if !adapter_names.is_empty() {

Loading…
Cancel
Save