Skip to content

zlint: init at 3.4.0 - #201537

Merged
cole-h merged 3 commits into
NixOS:masterfrom
baloo:baloo/zlint/init
Nov 23, 2022
Merged

cole-h merged 3 commits into
NixOS:masterfrom
baloo:baloo/zlint/init

Conversation

@baloo

@baloo baloo commented Nov 16, 2022 •

Copy link
Copy Markdown
Member
Description of changes

This adds zlint which is a linter for certificates.

Things done
  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandbox = true set in nix.conf? (See Nix manual)
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 22.11 Release Notes (or backporting 22.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
    • (Release notes changes) Ran nixos/doc/manual/md-to-db.sh to update generated release notes
  • Fits CONTRIBUTING.md.

@ofborg ofborg Bot added 8.has: package (new) This PR adds a new package 11.by: package-maintainer This PR was created by a maintainer of all the package it changes. 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-darwin: 1 This PR causes 1 package to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-linux: 1 This PR causes 1 package to rebuild on Linux. labels Nov 16, 2022

@azahi azahi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There were a lot of changes which I wanted to suggest so it would be easier if I just drop a patch for you to apply.

diff --git i/pkgs/tools/security/zlint/default.nix w/pkgs/tools/security/zlint/default.nix
index 4116e3bf717..9d85b181a62 100644
--- i/pkgs/tools/security/zlint/default.nix
+++ w/pkgs/tools/security/zlint/default.nix
@@ -1,4 +1,10 @@
-{ buildGoModule, fetchFromGitHub, lib }:
+{ lib
+, buildGoModule
+, fetchFromGitHub
+, git
+, testers
+, zlint
+}:
 
 buildGoModule rec {
   pname = "zlint";
@@ -6,25 +12,54 @@ buildGoModule rec {
 
   src = fetchFromGitHub {
     owner = "zmap";
-    repo = pname;
+    repo = "zlint";
     rev = "v${version}";
-    sha256 = "sha256-l39GdfEKUAw5DQNjx6ZBgfGtengRlUUasm0G07kAA2A=";
+    leaveDotGit = true;
+    hash = "sha256-1T8WAWsivSEB2xVEM+GpWJuD3DGXPa9uNpuN6/ABsns=";
   };
 
   modRoot = "v3";
+
   vendorHash = "sha256-OiHEyMHuSiWDB/1YRvAhErb1h/rFfXXVcagcP386doc=";
-  preBuild = ''
-    # not in the go.mod
-    rm -rf cmd/genTestCerts
+
+  postPatch = ''
+    # Remove a package which is not declared in go.mod.
+    rm -rf v3/cmd/genTestCerts
+  '';
+
+  subPackages = [
+    "cmd/zlint"
+    "cmd/zlint-gtld-update"
+  ];
+
+  ldflags = [
+    "-s"
+    "-w"
+    "-X main.version=${version}"
+  ];
+
+  checkInputs = [ git ];
+
+  preCheck = ''
+    # Test all targets.
+    unset subPackages
   '';
 
-  # Tests rely on git and we don't have the .git dir because modRoot is in a subdir
-  doCheck = false;
+  passthru.tests.version = testers.testVersion {
+    package = zlint;
+    command = "zlint -version";
+  };
 
   meta = with lib; {
-    homepage = "https://github.com/zmap/zlint/";
+    description = "X.509 Certificate Linter focused on Web PKI standards and requirements";
+    longDescription = ''
+      ZLint is a X.509 certificate linter written in Go that checks for
+      consistency with standards (e.g. RFC 5280) and other relevant PKI
+      requirements (e.g. CA/Browser Forum Baseline Requirements).
+    '';
+    homepage = "https://github.com/zmap/zlint";
+    changelog = "https://github.com/zmap/zlint/releases/tag/${src.rev}";
     license = licenses.asl20;
-    description = "X.509 Certificate Linter focused on Web PKI standards and requirements.";
     maintainers = with maintainers; [ baloo ];
   };
 }

Here's the complete file if applying didn't work.

@baloo

baloo commented Nov 18, 2022 •

Copy link
Copy Markdown
Member Author

@azahi that is a lot more than I know about! Would you want to be added in the maintainers maybe?

(in any case, thank you!)

@azahi

azahi commented Nov 18, 2022

Copy link
Copy Markdown
Member

The build currently fails due to a hash mismatch, could you please fix that. Otherwise I think we're good.

Would you want to be added in the maintainers maybe?

That's not necessary.

@baloo

baloo commented Nov 18, 2022

Copy link
Copy Markdown
Member Author

@azahi the hash mismatch is inconsistent.
I got fetchFromGitHub to generate both. I believe the leaveDotGit renders the derivation non-reproducible.

@baloo

baloo commented Nov 18, 2022

Copy link
Copy Markdown
Member Author
$ nix-build /nix/store/axhgyqdmpr9h3x4s0b4fsnnaa2kni1hz-source.drv --check
checking outputs of '/nix/store/axhgyqdmpr9h3x4s0b4fsnnaa2kni1hz-source.drv'...
exporting https://github.com/zmap/zlint.git (rev v3.4.0) into /nix/store/fp5p9nmpjn3k61df75dr37zrv3vnman9-source
Initialized empty Git repository in /nix/store/fp5p9nmpjn3k61df75dr37zrv3vnman9-source/.git/
remote: Enumerating objects: 1431, done.
remote: Counting objects: 100% (1431/1431), done.
remote: Compressing objects: 100% (1003/1003), done.
remote: Total 1431 (delta 652), reused 1039 (delta 422), pack-reused 0
Receiving objects: 100% (1431/1431), 2.00 MiB | 2.65 MiB/s, done.
Resolving deltas: 100% (652/652), done.
From https://github.com/zmap/zlint
 * tag               v3.4.0     -> FETCH_HEAD
Switched to a new branch 'fetchgit'
Enumerating objects: 1430, done.
Counting objects: 100% (1430/1430), done.
Compressing objects: 100% (1424/1424), done.
Writing objects: 100% (1430/1430), done.
Total 1430 (delta 623), reused 764 (delta 0), pack-reused 0
Enumerating objects: 1430, done.
Nothing new to pack.
/nix/store/fp5p9nmpjn3k61df75dr37zrv3vnman9-source
$ nix-build /nix/store/axhgyqdmpr9h3x4s0b4fsnnaa2kni1hz-source.drv --check
checking outputs of '/nix/store/axhgyqdmpr9h3x4s0b4fsnnaa2kni1hz-source.drv'...
exporting https://github.com/zmap/zlint.git (rev v3.4.0) into /nix/store/fp5p9nmpjn3k61df75dr37zrv3vnman9-source
Initialized empty Git repository in /nix/store/fp5p9nmpjn3k61df75dr37zrv3vnman9-source/.git/
remote: Enumerating objects: 1431, done.
remote: Counting objects: 100% (1431/1431), done.
remote: Compressing objects: 100% (1003/1003), done.
remote: Total 1431 (delta 652), reused 1040 (delta 422), pack-reused 0
Receiving objects: 100% (1431/1431), 2.00 MiB | 3.90 MiB/s, done.
Resolving deltas: 100% (652/652), done.
From https://github.com/zmap/zlint
 * tag               v3.4.0     -> FETCH_HEAD
Switched to a new branch 'fetchgit'
Enumerating objects: 1430, done.
Counting objects: 100% (1430/1430), done.
Compressing objects: 100% (1424/1424), done.
Writing objects: 100% (1430/1430), done.
Total 1430 (delta 623), reused 764 (delta 0), pack-reused 0
Enumerating objects: 1430, done.
Nothing new to pack.
error: hash mismatch in fixed-output derivation '/nix/store/axhgyqdmpr9h3x4s0b4fsnnaa2kni1hz-source.drv':
         specified: sha256-1T8WAWsivSEB2xVEM+GpWJuD3DGXPa9uNpuN6/ABsns=
            got:    sha256-se8Z31dBhoarqouFkVjOPIG86K5G/VabIKT9V6RgRKM=

@azahi azahi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's weird, but I guess we can just drop checks. LGTM.

@cole-h cole-h left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems fine to me.

Result of nixpkgs-review pr 201537 run on x86_64-linux 1

1 package built:
  • zlint

@cole-h
cole-h merged commit f9cdaba into NixOS:master Nov 23, 2022
@baloo
baloo deleted the baloo/zlint/init branch November 23, 2022 18:49
Comment on lines +39 to +40
# Checks rely on .git directory, leaveDotGit makes the source derivation flaky.
doCheck = false;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we patch that it requires a git directory?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that got dropped in 3.4.1 which just released on Sunday and that I missed.
#202590

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

8.has: package (new) This PR adds a new package 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-darwin: 1 This PR causes 1 package to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-linux: 1 This PR causes 1 package to rebuild on Linux. 11.by: package-maintainer This PR was created by a maintainer of all the package it changes.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants