Unverified Commit 38b57cc2 authored by github-actions[bot]'s avatar github-actions[bot] Committed by GitHub
Browse files

Merge staging-next into staging

parents f59383d6 d98191ce
Loading
Loading
Loading
Loading
+49 −0
Original line number Diff line number Diff line
@@ -116,6 +116,55 @@ It has two modes:

: The `lychee` package to use.

## `shellcheck` {#tester-shellcheck}

Runs files through `shellcheck`, a static analysis tool for shell scripts.

:::{.example #ex-shellcheck}
# Run `testers.shellcheck`

A single script

```nix
testers.shellcheck {
  name = "shellcheck";
  src = ./script.sh;
}
```

Multiple files

```nix
let
  inherit (lib) fileset;
in
testers.shellcheck {
  name = "shellcheck";
  src = fileset.toSource {
    root = ./.;
    fileset = fileset.unions [
      ./lib.sh
      ./nixbsd-activate
    ];
  };
}
```

:::

### Inputs {#tester-shellcheck-inputs}

[`src` (path or string)]{#tester-shellcheck-param-src}

: The path to the shell script(s) to check.
  This can be a single file or a directory containing shell files.
  All files in `src` will be checked, so you may want to provide `fileset`-based source instead of a whole directory.

### Return value {#tester-shellcheck-return}

A derivation that runs `shellcheck` on the given script(s).
The build will fail if `shellcheck` finds any issues.

## `testVersion` {#tester-testVersion}

Checks that the output from running a command contains the specified version string in it as a whole word.
+13 −0
Original line number Diff line number Diff line
@@ -20260,6 +20260,13 @@
    githubId = 71843723;
    keys = [ { fingerprint = "EEFB CC3A C529 CFD1 943D  A75C BDD5 7BE9 9D55 5965"; } ];
  };
  thepuzzlemaker = {
    name = "ThePuzzlemaker";
    email = "tpzker@thepuzzlemaker.info";
    github = "ThePuzzlemaker";
    githubId = 12666617;
    keys = [ { fingerprint = "7095 C20A 9224 3DB6 5177  07B0 968C D9D7 1C9F BB6C"; } ];
  };
  therealansh = {
    email = "tyagiansh23@gmail.com";
    github = "therealansh";
@@ -21578,6 +21585,12 @@
    githubId = 70410;
    name = "Rahul Gopinath";
  };
  vsharathchandra = {
    email = "chandrasharath.v@gmail.com";
    github = "vsharathchandra";
    githubId = 12689380;
    name = "sharath chandra";
  };
  vskilet = {
    email = "victor@sene.ovh";
    github = "Vskilet";
+4 −0
Original line number Diff line number Diff line
@@ -12,6 +12,7 @@ let
    mkDefault
    mkIf
    mkOption
    stringAfter
    types
    ;

@@ -97,5 +98,8 @@ in
    systemd.tmpfiles.rules = lib.mkIf cfg.channel.enable [
      ''f /root/.nix-channels - - - - ${config.system.defaultChannel} nixos\n''
    ];

    system.activationScripts.no-nix-channel = mkIf (!cfg.channel.enable)
      (stringAfter [ "etc" "users" ] (builtins.readFile ./nix-channel/activation-check.sh));
  };
}
+21 −0
Original line number Diff line number Diff line
# shellcheck shell=bash

explainChannelWarning=0
if [[ -e "/root/.nix-defexpr/channels" ]]; then
    warn '/root/.nix-defexpr/channels exists, but channels have been disabled.'
    explainChannelWarning=1
fi
if [[ -e "/nix/var/nix/profiles/per-user/root/channels" ]]; then
    warn "/nix/var/nix/profiles/per-user/root/channels exists, but channels have been disabled."
    explainChannelWarning=1
fi
while IFS=: read -r _ _ _ _ _ home _ ; do
    if [[ -n  "$home" && -e "$home/.nix-defexpr/channels" ]]; then
        warn "$home/.nix-defexpr/channels exists, but channels have been disabled." 1>&2
        explainChannelWarning=1
    fi
done < <(getent passwd)
if [[ $explainChannelWarning -eq 1 ]]; then
    echo "Due to https://github.com/NixOS/nix/issues/9574, Nix may still use these channels when NIX_PATH is unset." 1>&2
    echo "Delete the above directory or directories to prevent this." 1>&2
fi
+19 −0
Original line number Diff line number Diff line
# Run:
#   nix-build -A nixosTests.nix-channel
{ lib, testers }:
let
  inherit (lib) fileset;

  runShellcheck = testers.shellcheck {
    src = fileset.toSource {
      root = ./.;
      fileset = fileset.unions [
        ./activation-check.sh
      ];
    };
  };

in
lib.recurseIntoAttrs {
  inherit runShellcheck;
}
Loading