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

treewide: get rid of with lib; and friends #209325

Closed
wants to merge 7 commits into from
2 changes: 0 additions & 2 deletions nixos/maintainers/scripts/cloudstack/cloudstack-image.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

{ config, lib, pkgs, ... }:

with lib;
Copy link
Contributor

Choose a reason for hiding this comment

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

Would be nice to have a PR with only those removals, since this one can be merged really fast.

Copy link
Member Author

Choose a reason for hiding this comment

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

I am not following.
My idea is that each commit should be buildable. If I merely remove the with lib and merge, obviously it will generate errors like "mkDefault not defined".

Copy link
Contributor

Choose a reason for hiding this comment

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

What do you mean? That this commit is broken them? Because it is clear that a few files only remove with lib; and do nothing else.

Copy link
Contributor

Choose a reason for hiding this comment

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

I am talking about only about the files that remove with lib; and do nothing else BTW.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good idea.

Copy link
Member

Choose a reason for hiding this comment

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

Yes, same idea from me. If we can remove a with anywhere without having regressions we can immediately merge it. This can also be done treewide to make mistakes in commits unlikely.

This change is uncontroversial for me


{
imports =
[ ../../../modules/virtualisation/cloudstack-config.nix ];
Expand Down
2 changes: 0 additions & 2 deletions nixos/maintainers/scripts/lxd/lxd-image-inner.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

{ config, pkgs, lib, ... }:

with lib;

{
imports =
[ # Include the default lxd configuration.
Expand Down
2 changes: 0 additions & 2 deletions nixos/maintainers/scripts/lxd/lxd-image.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
{ lib, config, pkgs, ... }:

with lib;

{
imports = [
../../../modules/virtualisation/lxc-container.nix
Expand Down
2 changes: 0 additions & 2 deletions nixos/maintainers/scripts/lxd/nix.tpl
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
{ lib, config, pkgs, ... }:

with lib;

# WARNING: THIS CONFIGURATION IS AUTOGENERATED AND WILL BE OVERWRITTEN AUTOMATICALLY

{
Expand Down
9 changes: 3 additions & 6 deletions nixos/modules/testing/test-instrumentation.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,9 @@

{ options, config, lib, pkgs, ... }:

with lib;

let
qemu-common = import ../../lib/qemu-common.nix { inherit lib pkgs; };
in

{

config = {
Expand Down Expand Up @@ -118,8 +115,8 @@ in
boot.consoleLogLevel = 7;

# Prevent tests from accessing the Internet.
networking.defaultGateway = mkOverride 150 "";
networking.nameservers = mkOverride 150 [ ];
networking.defaultGateway = lib.mkOverride 150 "";
networking.nameservers = lib.mkOverride 150 [ ];

system.requiredKernelConfig = with config.lib.kernelConfig; [
(isYes "SERIAL_8250_CONSOLE")
Expand All @@ -130,7 +127,7 @@ in
networking.usePredictableInterfaceNames = false;

# Make it easy to log in as root when running the test interactively.
users.users.root.initialHashedPassword = mkOverride 150 "";
users.users.root.initialHashedPassword = lib.mkOverride 150 "";

services.xserver.displayManager.job.logToJournal = true;

Expand Down
1 change: 0 additions & 1 deletion nixos/tests/hardened.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import ./make-test-python.nix ({ pkgs, ... } : {

nodes.machine =
{ lib, pkgs, config, ... }:
with lib;
{ users.users.alice = { isNormalUser = true; extraGroups = [ "proc" ]; };
users.users.sybil = { isNormalUser = true; group = "wheel"; };
imports = [ ../modules/profiles/hardened.nix ];
Expand Down
2 changes: 0 additions & 2 deletions nixos/tests/nfs/kerberos.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import ../make-test-python.nix ({ pkgs, lib, ... }:

with lib;

let
krb5 =
{ enable = true;
Expand Down