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

StevenBlack-hosts: init at 2.5.52 #80113

Closed
wants to merge 14 commits into from
Closed

Conversation

pasqui23
Copy link
Contributor

Motivation for this change

Adbloking based on @StevenBlack 's excellent hosts file

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)
  • 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.

@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/prs-ready-for-review-may-2019/3032/118

Copy link
Member

@mmilata mmilata left a comment

Choose a reason for hiding this comment

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

Looks quite good, I've added a few formal nitpicks to make review easier for someone who can actually merge. Also:

  • I think it's preferred to have package and module updates in separate commits
  • there's bunch of whitespace issues, perhaps try using one of the nix formatting tools?

nixos/modules/services/networking/StevenBlack-hosts.nix Outdated Show resolved Hide resolved
nixos/modules/services/networking/StevenBlack-hosts.nix Outdated Show resolved Hide resolved
owner = "StevenBlack";
repo = "hosts";
rev = version;
sha256 ="zQMzXci1/21PCvi8AGqyDataQl/kQJJ+jszxXd2XMQc=";
Copy link
Member

Choose a reason for hiding this comment

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

I'd suggest using the base32 hash format which is more prevalent in nixpkgs and used by tools such as nix-prefetch-url:

nix-hash --type sha256 --to-base32 "zQMzXci1/21PCvi8AGqyDataQl/kQJJ+jszxXd2XMQc="

Co-Authored-By: Martin Milata <martin@martinmilata.cz>
};

networking.extraHosts =
builtins.readFile (pkgs.StevenBlack-hosts.override{
Copy link
Member

Choose a reason for hiding this comment

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

This is a bit ugly here, I think this is IFD (import-from-derivation), where a derivation needs to be built during evaluation time. I just created #81945 to get around this, after which you will be able to do

{
  networking.hostFiles = [
    (pkgs.StevenBlack-hosts.override { /* ... */ })
  ];
}

Copy link
Member

Choose a reason for hiding this comment

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

Just merged above PR, so this can be done now

'';

installPhase = ''
cp hosts $out
Copy link
Member

Choose a reason for hiding this comment

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

It might be a good idea to not put this in $out directly, but rather $out/share/StevenBlack-hosts/hosts. This then also allows people to install the package with environment.systemPackages or so, after which the hosts file will be in /run/current-system/sw/share/StevenBlack-hosts/hosts

@pasqui23
Copy link
Contributor Author

I have incorporated @infinisil 's suggestions

Copy link
Member

@infinisil infinisil left a comment

Choose a reason for hiding this comment

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

Also see @mmilata's review here: #80113 (review)

@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/prs-ready-for-review/3032/331

@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/prs-ready-for-review/3032/465

@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/prs-ready-for-review/3032/485

pkgs/top-level/all-packages.nix Outdated Show resolved Hide resolved
pkgs/applications/networking/StevenBlack-hosts/default.nix Outdated Show resolved Hide resolved
Co-authored-by: Sandro <sandro.jaeckel@gmail.com>
@SuperSandro2000
Copy link
Member

@pasqui23 can you fix the eval error?

@ofborg eval

Co-authored-by: Sandro <sandro.jaeckel@gmail.com>
Co-authored-by: Sandro <sandro.jaeckel@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants