Skip to content

Commit

Permalink
Rename to nixpkgs-vet (#101)
Browse files Browse the repository at this point in the history
  • Loading branch information
infinisil authored Aug 29, 2024
2 parents 480c5a7 + b1d5632 commit a6a9f37
Show file tree
Hide file tree
Showing 10 changed files with 31 additions and 31 deletions.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Contributor documentation

[@infinisil](https://github.com/infinisil) is the admin and main developer of this repository,
while everybody in [@NixOS/nixpkgs-check-by-name](https://github.com/orgs/NixOS/teams/nixpkgs-check-by-name) has write access.
while everybody in [@NixOS/nixpkgs-vet](https://github.com/orgs/NixOS/teams/nixpkgs-vet) has write access.

## Development

Expand Down
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
@@ -1,5 +1,5 @@
[package]
name = "nixpkgs-check-by-name"
name = "nixpkgs-vet"
version = "0.1.3"
edition = "2021"

Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ There is no guarantee that the derivation succeeds on systems that don't have [p
but it can be attempted with

```bash
nix-build https://github.com/NixOS/nixpkgs-check-by-name/tarball/master -A build
nix-build https://github.com/NixOS/nixpkgs-vet/tarball/master -A build
```

## Prebuilt store paths

The [GitHub releases](https://github.com/NixOS/nixpkgs-check-by-name/releases)
The [GitHub releases](https://github.com/NixOS/nixpkgs-vet/releases)
contain a [gzip](https://en.wikipedia.org/wiki/Gzip)-compressed
[Nix Archive](https://nixos.org/manual/nix/stable/command-ref/nix-store/export.html)
of the [build closure](https://nixos.org/manual/nix/stable/glossary#gloss-closure)
Expand All @@ -54,11 +54,11 @@ and is therefore much faster and less storage intensive.
## Binary interface

The store path acquired from the above methods contains
a `system`-specific binary under `$storePath/bin/nixpkgs-check-by-name`.
a `system`-specific binary under `$storePath/bin/nixpkgs-vet`.

The public interface of this binary is printed by calling
```bash
result/bin/nixpkgs-check-by-name --help
result/bin/nixpkgs-vet --help
```

## Validity checks
Expand Down
6 changes: 3 additions & 3 deletions default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ let
};

shell = pkgs.mkShell {
env.NIX_CHECK_BY_NAME_NIX_PACKAGE = lib.getBin defaultNixPackage;
env.NIX_CHECK_BY_NAME_NIXPKGS_LIB = "${nixpkgs}/lib";
env.NIXPKGS_VET_NIX_PACKAGE = lib.getBin defaultNixPackage;
env.NIXPKGS_VET_NIXPKGS_LIB = "${nixpkgs}/lib";
env.RUST_SRC_PATH = "${pkgs.rustPlatform.rustLibSrc}";
inputsFrom = [ packages.build ];
nativeBuildInputs = with pkgs; [
Expand Down Expand Up @@ -156,7 +156,7 @@ let
# Tests the tool on the pinned Nixpkgs tree with stable Nix. This is a good sanity check.
nixpkgsCheck = pkgs.callPackage ./nixpkgs-check.nix {
inherit initNix nixpkgs;
nixpkgs-check-by-name = packages.build;
nixpkgs-vet = packages.build;
nix = pkgs.nixVersions.stable;
};

Expand Down
14 changes: 7 additions & 7 deletions nixpkgs-check.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
lib,
runCommand,
nixpkgs-check-by-name,
nixpkgs-vet,
initNix,
nixpkgs,
nix,
Expand All @@ -28,14 +28,14 @@ let

mkNixpkgsCheck =
name: nix:
runCommand "test-nixpkgs-check-by-name-with-${nix.name}"
runCommand "test-nixpkgs-vet-with-${nix.name}"
{
nativeBuildInputs = [
nixpkgs-check-by-name
nixpkgs-vet
nix
];

env.NIX_CHECK_BY_NAME_NIX_PACKAGE = lib.getBin nix;
env.NIXPKGS_VET_NIX_PACKAGE = lib.getBin nix;

passthru = {
# Allow running against all other Nix versions.
Expand All @@ -47,9 +47,9 @@ let
}
''
${initNix}
# This is what nixpkgs-check-by-name uses
export NIX_CHECK_BY_NAME_NIX_PACKAGE=${lib.getBin nix}
${nixpkgs-check-by-name}/bin/.nixpkgs-check-by-name-wrapped --base "${nixpkgs}" "${nixpkgs}"
# This is what nixpkgs-vet uses
export NIXPKGS_VET_NIX_PACKAGE=${lib.getBin nix}
${nixpkgs-vet}/bin/.nixpkgs-vet-wrapped --base "${nixpkgs}" "${nixpkgs}"
touch $out
'';
in
Expand Down
14 changes: 7 additions & 7 deletions package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ let
fs = lib.fileset;
in
rustPlatform.buildRustPackage {
pname = "nixpkgs-check-by-name";
pname = "nixpkgs-vet";
inherit version;

src = fs.toSource {
Expand All @@ -44,8 +44,8 @@ rustPlatform.buildRustPackage {
makeWrapper
];

env.NIX_CHECK_BY_NAME_NIX_PACKAGE = lib.getBin nix;
env.NIX_CHECK_BY_NAME_NIXPKGS_LIB = "${path}/lib";
env.NIXPKGS_VET_NIX_PACKAGE = lib.getBin nix;
env.NIXPKGS_VET_NIXPKGS_LIB = "${path}/lib";

checkPhase = ''
# This path will be symlinked to the current version that is being tested
Expand All @@ -54,8 +54,8 @@ rustPlatform.buildRustPackage {
# For initNix
export PATH=$nixPackage/bin:$PATH
# This is what nixpkgs-check-by-name uses
export NIX_CHECK_BY_NAME_NIX_PACKAGE=$nixPackage
# This is what nixpkgs-vet uses
export NIXPKGS_VET_NIX_PACKAGE=$nixPackage
${lib.concatMapStringsSep "\n" (nix: ''
ln -s ${lib.getBin nix} "$nixPackage"
Expand All @@ -69,7 +69,7 @@ rustPlatform.buildRustPackage {
cargo clippy --all-targets -- -D warnings
'';
postInstall = ''
wrapProgram $out/bin/nixpkgs-check-by-name \
--set NIX_CHECK_BY_NAME_NIX_PACKAGE ${lib.getBin nix}
wrapProgram $out/bin/nixpkgs-vet \
--set NIXPKGS_VET_NIX_PACKAGE ${lib.getBin nix}
'';
}
2 changes: 1 addition & 1 deletion scripts/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ nixeval() {
system=x86_64-linux
root=$(git rev-parse --show-toplevel)
rev=$(git -C "$root" rev-parse HEAD)
repository=${GITHUB_REPOSITORY:-NixOS/nixpkgs-check-by-name}
repository=${GITHUB_REPOSITORY:-NixOS/nixpkgs-vet}

# Get the version from the Cargo.toml file
version=$(nixeval "$root" -A version)
Expand Down
10 changes: 5 additions & 5 deletions src/eval.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,8 @@ fn mutate_nix_instatiate_arguments_based_on_cfg(
command.arg(&format!("test-nixpkgs={}", mock_nixpkgs_path.display()));

// Retrieve the path to the real nixpkgs lib, then wire it up to `import <test-nixpkgs/lib>`.
let nixpkgs_lib = env::var("NIX_CHECK_BY_NAME_NIXPKGS_LIB")
.with_context(|| "Could not get environment variable NIX_CHECK_BY_NAME_NIXPKGS_LIB")?;
let nixpkgs_lib = env::var("NIXPKGS_VET_NIXPKGS_LIB")
.with_context(|| "Could not get environment variable NIXPKGS_VET_NIXPKGS_LIB")?;

command.arg("-I");
command.arg(&format!("test-nixpkgs/lib={nixpkgs_lib}"));
Expand All @@ -157,7 +157,7 @@ pub fn check_values(
package_names: Vec<String>,
) -> validation::Result<ratchet::Nixpkgs> {
let work_dir = Builder::new()
.prefix("nixpkgs-check-by-name")
.prefix("nixpkgs-vet")
.tempdir()
.with_context(|| "Failed to create a working directory")?;

Expand All @@ -179,8 +179,8 @@ pub fn check_values(
fs::write(&eval_nix_path, EVAL_NIX)?;

// Pinning Nix in this way makes the tool more reproducible
let nix_package = env::var("NIX_CHECK_BY_NAME_NIX_PACKAGE")
.with_context(|| "Could not get environment variable NIX_CHECK_BY_NAME_NIX_PACKAGE")?;
let nix_package = env::var("NIXPKGS_VET_NIX_PACKAGE")
.with_context(|| "Could not get environment variable NIXPKGS_VET_NIX_PACKAGE")?;

// With restrict-eval, only paths in NIX_PATH can be accessed. We explicitly specify them here.
let mut command = process::Command::new(format!("{nix_package}/bin/nix-instantiate"));
Expand Down
2 changes: 1 addition & 1 deletion tests/non-by-name-trace/README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
This test makes sure that if evaluating top-level attributes give warnings, they won't end up in
the output, see https://github.com/NixOS/nixpkgs-check-by-name/issues/30 for more context
the output, see https://github.com/NixOS/nixpkgs-vet/issues/30 for more context

0 comments on commit a6a9f37

Please sign in to comment.