Unverified Commit cc39ca56 authored by Philip Taron's avatar Philip Taron Committed by GitHub
Browse files

treewide: eliminate unnecessary `__curPos` usage in nixpkgs (#491160)

parents ef7fd34a 04f9003b
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -18,7 +18,6 @@ let
    };

  modularServicesModule = {
    _file = "${__curPos.file}:${toString __curPos.line}";
    options = {
      "<imports = [ pkgs.ghostunnel.services.default ]>" = fakeSubmodule pkgs.ghostunnel.services.default;
      "<imports = [ pkgs.php.services.default ]>" = fakeSubmodule pkgs.php.services.default;
+15 −8
Original line number Diff line number Diff line
@@ -218,27 +218,34 @@ in
          KEYS="$(${hostPkgs.nix}/bin/nix-store --add "$KEYS")" ${lib.getExe config.system.build.vm}
        '';

        script = hostPkgs.writeShellScriptBin "create-builder" ''
      in
      hostPkgs.writeTextFile {
        name = "create-builder";
        executable = true;
        destination = "/bin/create-builder";
        text = ''
          #!${hostPkgs.runtimeShell}
          set -euo pipefail
          export KEYS="''${KEYS:-./keys}"
          ${lib.getExe add-keys}
          ${lib.getExe run-builder}
        '';

      in
      script.overrideAttrs (old: {
        pos = __curPos; # sets meta.position to point here; see script binding above for package definition
        meta = (old.meta or { }) // {
        checkPhase = ''
          ${hostPkgs.stdenv.shellDryRun} "$target"
        '';
        meta = {
          mainProgram = "create-builder";
          description = "Create a Linux builder VM for macOS";
          platforms = lib.platforms.darwin;
        };
        passthru = (old.passthru or { }) // {
        passthru = {
          # Let users in the repl inspect the config
          nixosConfig = config;
          nixosOptions = options;

          inherit add-keys run-builder;
        };
      });
      };

    system = {
      # To prevent gratuitous rebuilds on each change to Nixpkgs
+0 −1
Original line number Diff line number Diff line
@@ -22,7 +22,6 @@ let
    };

  exampleConfig = {
    _file = "${__curPos.file}:${toString __curPos.line}";
    services = {
      service1 = {
        process = {
+0 −1
Original line number Diff line number Diff line
@@ -564,7 +564,6 @@ in
                          extraConfig =
                            { options, ... }:
                            {
                              _file = "module at ${__curPos.file}:${toString __curPos.line}";
                              config = {
                                nixpkgs =
                                  if options.nixpkgs ? hostPlatform then
+1 −19
Original line number Diff line number Diff line
@@ -112,7 +112,7 @@ let
        ((import ../lib/testing-python.nix { inherit system pkgs; }).evalTest {
          imports = [
            arg
            readOnlyPkgs
            ./read-only-pkgs.nix
          ];
        }).config.result;
      findTests =
@@ -140,24 +140,6 @@ let
    runTestOn
    ;

  # Using a single instance of nixpkgs makes test evaluation faster.
  # To make sure we don't accidentally depend on a modified pkgs, we make the
  # related options read-only. We need to test the right configuration.
  #
  # If your service depends on a nixpkgs setting, first try to avoid that, but
  # otherwise, you can remove the readOnlyPkgs import and test your service as
  # usual.
  readOnlyPkgs =
    # TODO: We currently accept this for nixosTests, so that the `pkgs` argument
    #       is consistent with `pkgs` in `pkgs.nixosTests`. Can we reinitialize
    #       it with `allowAliases = false`?
    # warnIf pkgs.config.allowAliases "nixosTests: pkgs includes aliases."
    {
      _file = "${__curPos.file} readOnlyPkgs";
      _class = "nixosTest";
      node.pkgs = pkgs.pkgsLinux;
    };

in
{

Loading