Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

atop, netatop, nixos/atop: improve packaging and options #123053

Merged
merged 11 commits into from
May 18, 2021

Conversation

pschyska
Copy link
Contributor

@pschyska pschyska commented May 15, 2021

Motivation for this change

The atop package where missing some files from upstream that I wanted to use (systemd units), mostly because $out instead of $(out) was used in a make context and this led to them not being copied.
The netatop package was missing the unit file for the netatop service, which is required for process accounting.
The nixos/atop module was extended to include configuration for all of atop's standard components, and optionally atopgpu and netatop.

Because I don't have a NVIDIA GPU, I wasn't able to test atopgpud.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests) (added new test)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@github-actions github-actions bot added 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: module (update) This PR changes an existing module in `nixos/` labels May 15, 2021
@ofborg ofborg bot requested review from 7c6f434c and viric May 15, 2021 00:23
@ofborg ofborg bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 11-100 labels May 15, 2021
@r-rmcgibbo
Copy link

r-rmcgibbo commented May 15, 2021

Result of nixpkgs-review pr 123053 at a8898703 run on aarch64-linux 1

8 packages marked as broken and skipped:
  • linuxPackages-libre.netatop
  • linuxPackages_4_4.netatop
  • linuxPackages_4_9.netatop
  • linuxPackages_hardkernel_4_14.netatop
  • linuxPackages_hardkernel_latest.netatop
  • linuxPackages_latest-libre.netatop
  • linuxPackages_testing_bcachefs.netatop
  • linuxPackages_xanmod.netatop
11 packages built successfully:
  • atop
  • linuxPackages.netatop (linuxPackages_5_10.netatop)
  • linuxPackages_4_14.netatop
  • linuxPackages_4_19.netatop
  • linuxPackages_5_11.netatop (linuxPackages_latest.netatop)
  • linuxPackages_5_12.netatop
  • linuxPackages_5_4.netatop
  • linuxPackages_hardened.netatop
  • linuxPackages_latest_hardened.netatop
  • linuxPackages_lqx.netatop
  • linuxPackages_zen.netatop

Result of nixpkgs-review pr 123053 at a8898703 run on x86_64-linux 1

4 packages marked as broken and skipped:
  • linuxPackages-libre.netatop
  • linuxPackages_hardkernel_4_14.netatop
  • linuxPackages_hardkernel_latest.netatop
  • linuxPackages_latest-libre.netatop
15 packages built successfully:
  • atop
  • linuxPackages.netatop (linuxPackages_5_10.netatop)
  • linuxPackages_4_14.netatop
  • linuxPackages_4_19.netatop
  • linuxPackages_4_4.netatop
  • linuxPackages_4_9.netatop
  • linuxPackages_5_11.netatop (linuxPackages_latest.netatop)
  • linuxPackages_5_12.netatop
  • linuxPackages_5_4.netatop
  • linuxPackages_hardened.netatop
  • linuxPackages_latest_hardened.netatop
  • linuxPackages_lqx.netatop
  • linuxPackages_testing_bcachefs.netatop
  • linuxPackages_xanmod.netatop
  • linuxPackages_zen.netatop
7 suggestions:
  • warning: missing-patch-comment

    Consider adding a comment explaining the purpose of this patch on the line preceeding.
    Near pkgs/os-specific/linux/netatop/default.nix:19:15:

       |
    19 |   patches = [ ./netatop.service.patch ];
       |               ^
    
  • warning: missing-patch-comment

    Consider adding a comment explaining the purpose of this patch on the line preceeding.
    Near pkgs/os-specific/linux/atop/default.nix:41:5:

       |
    41 |     ./atopacct.service.patch
       |     ^
    
  • warning: missing-patch-comment

    Consider adding a comment explaining the purpose of this patch on the line preceeding.
    Near pkgs/os-specific/linux/atop/default.nix:38:5:

       |
    38 |     ./atop-pm.sh.patch
       |     ^
    
  • warning: missing-patch-comment

    Consider adding a comment explaining the purpose of this patch on the line preceeding.
    Near pkgs/os-specific/linux/atop/default.nix:42:31:

       |
    42 |   ] ++ (if withAtopgpu then [ ./atopgpu.service.patch ] else [ ]);
       |                               ^
    
  • warning: unclear-gpl

    gpl2 is a deprecated license, please check if project uses gpl2Plus or gpl2Only and change meta.license accordingly.

    Near pkgs/os-specific/linux/netatop/default.nix:42:5:

       |
    42 |     license = lib.licenses.gpl2;
       |     ^
    
  • warning: missing-patch-comment

    Consider adding a comment explaining the purpose of this patch on the line preceeding.
    Near pkgs/os-specific/linux/atop/default.nix:39:5:

       |
    39 |     ./atop-rotate.service.patch
       |     ^
    
  • warning: missing-patch-comment

    Consider adding a comment explaining the purpose of this patch on the line preceeding.
    Near pkgs/os-specific/linux/atop/default.nix:40:5:

       |
    40 |     ./atop.service.patch
       |     ^
    

nixos/tests/atop.nix Outdated Show resolved Hide resolved
- use "with subtest" everywhere
- do more in nix and less in python
- use makeTest directly to define multiple tests instead of one with
  multiple nodes -> this enables them to run in parallel
@pschyska
Copy link
Contributor Author

@ofborg test atop.everything

@pschyska pschyska requested a review from 7c6f434c May 16, 2021 20:12
@pschyska
Copy link
Contributor Author

Sorry @7c6f434c, I accidentally requested a re-review just now.

@7c6f434c
Copy link
Member

@ofborg test atop.defaults

I am not a very careful person

Copy link
Member

@7c6f434c 7c6f434c left a comment

Choose a reason for hiding this comment

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

Diff looks good

pkgs/os-specific/linux/atop/default.nix Outdated Show resolved Hide resolved
pkgs/os-specific/linux/atop/default.nix Outdated Show resolved Hide resolved
pkgs/os-specific/linux/atop/default.nix Outdated Show resolved Hide resolved
Comment on lines +28 to +34
"BINPATH=/bin"
"SBINPATH=/bin"
"MAN1PATH=/share/man/man1"
"MAN5PATH=/share/man/man5"
"MAN8PATH=/share/man/man8"
"SYSDPATH=/lib/systemd/system"
"PMPATHD=/lib/systemd/system-sleep"
Copy link
Member

Choose a reason for hiding this comment

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

Why do they not include $out?

Copy link
Contributor Author

@pschyska pschyska May 16, 2021

Choose a reason for hiding this comment

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

They are all used as like this: $(DESTDIR)$(BINPATH), so $out is correctly prepended.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@SuperSandro2000 Works for you? Alternativeley I can DESTDIR="" and fully qualify all the names, but then I'd have to go through the Makefile again because I only mentioned the keys that were relevant, and were wrong by default with DESTDIR=$(out).

pkgs/os-specific/linux/atop/default.nix Outdated Show resolved Hide resolved
pkgs/os-specific/linux/atop/default.nix Outdated Show resolved Hide resolved
Co-authored-by: Sandro <sandro.jaeckel@gmail.com>
@ofborg ofborg bot requested a review from 7c6f434c May 16, 2021 23:37
@pschyska
Copy link
Contributor Author

❤️ Thank you @7c6f434c @aanderse @SuperSandro2000

};
package = mkOption {
type = types.package;
default = config.boot.kernelPackages.netatop;
Copy link
Member

@samueldr samueldr May 21, 2021

Choose a reason for hiding this comment

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

detaultText attribute missing for a package.

This can lead to breakage in some evals:

error: attribute 'netatop' missing, at /nix/store/md569yk7k26jdknlbarfyai4i1lb7kkj-nixexprs.tar.xz/nixos/modules/programs/atop.nix:38:21

(The other option here with a package would also need a defaultText)

(I don't think we have a linkable discussion or documentation about how default values for types.package options can cause issues with evaluations, sorry :/)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hey @samueldr, sorry I broke your website build :-(
I'm opening a PR momentarily adding defaultTexts.
I'm having a problem with the tests locally, but I think I've got a fix already.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

No biggie about the build failure :). It's an unusual failure type that, for this particular package, won't be a problem on the Hydra for NixOS itself. So it's really not obvious that it can cause some fringe breakage.

@Shados
Copy link
Member

Shados commented May 31, 2021

This rather unexpected broke my atoprc because programs.atop.enable did not previously exist, but is now required to build it. Given this is a breaking change, it should probably at least get a mention in the NixOS release notes, if not an automated warning (although given the nature of the change, I don't think that could be cleanly done).

pschyska added a commit to pschyska/nixpkgs that referenced this pull request May 31, 2021
@pschyska
Copy link
Contributor Author

@Shados Sorry for breaking your config. This case slipped my attention. I just opened a mini PR adding a test for your case and a fix.

@FRidh
Copy link
Member

FRidh commented Apr 4, 2022

Note this allows the use of unfree packages. I am going to revert that part.

@Janik-Haag Janik-Haag added the 12. first-time contribution This PR is the author's first one; please be gentle! label Jun 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: module (update) This PR changes an existing module in `nixos/` 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 11-100 12. first-time contribution This PR is the author's first one; please be gentle!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants