Unverified Commit 1371fe63 authored by Martin Weinelt's avatar Martin Weinelt
Browse files

Merge remote-tracking branch 'origin/master' into staging-next

Conflicts:
- pkgs/servers/home-assistant/default.nix
parents 0f6ddea2 43306c5b
Loading
Loading
Loading
Loading
+106 −44
Original line number Diff line number Diff line
@@ -2,47 +2,87 @@

rec {

  /* Throw if pred is false, else return pred.
  /**
    Throw if pred is false, else return pred.
    Intended to be used to augment asserts with helpful error messages.

     Example:
    # Inputs

    `pred`

    : Predicate that needs to succeed, otherwise `msg` is thrown

    `msg`

    : Message to throw in case `pred` fails

    # Type

    ```
    assertMsg :: Bool -> String -> Bool
    ```

    # Examples
    :::{.example}
    ## `lib.asserts.assertMsg` usage example

    ```nix
    assertMsg false "nope"
    stderr> error: nope

    assert assertMsg ("foo" == "bar") "foo is not bar, silly"; ""
    stderr> error: foo is not bar, silly
    ```

     Type:
       assertMsg :: Bool -> String -> Bool
    :::
  */
  # TODO(Profpatsch): add tests that check stderr
  assertMsg =
    # Predicate that needs to succeed, otherwise `msg` is thrown
    pred:
    # Message to throw in case `pred` fails
    msg:
    pred || builtins.throw msg;

  /* Specialized `assertMsg` for checking if `val` is one of the elements
  /**
    Specialized `assertMsg` for checking if `val` is one of the elements
    of the list `xs`. Useful for checking enums.

     Example:
    # Inputs

    `name`

    : The name of the variable the user entered `val` into, for inclusion in the error message

    `val`

    : The value of what the user provided, to be compared against the values in `xs`

    `xs`

    : The list of valid values

    # Type

    ```
    assertOneOf :: String -> ComparableVal -> List ComparableVal -> Bool
    ```

    # Examples
    :::{.example}
    ## `lib.asserts.assertOneOf` usage example

    ```nix
    let sslLibrary = "libressl";
    in assertOneOf "sslLibrary" sslLibrary [ "openssl" "bearssl" ]
    stderr> error: sslLibrary must be one of [
    stderr>   "openssl"
    stderr>   "bearssl"
    stderr> ], but is: "libressl"
    ```

     Type:
       assertOneOf :: String -> ComparableVal -> List ComparableVal -> Bool
    :::
  */
  assertOneOf =
    # The name of the variable the user entered `val` into, for inclusion in the error message
    name:
    # The value of what the user provided, to be compared against the values in `xs`
    val:
    # The list of valid values
    xs:
    assertMsg
    (lib.elem val xs)
@@ -50,10 +90,35 @@ rec {
      lib.generators.toPretty {} xs}, but is: ${
        lib.generators.toPretty {} val}";

  /* Specialized `assertMsg` for checking if every one of `vals` is one of the elements
  /**
    Specialized `assertMsg` for checking if every one of `vals` is one of the elements
    of the list `xs`. Useful for checking lists of supported attributes.

     Example:
    # Inputs

    `name`

    : The name of the variable the user entered `val` into, for inclusion in the error message

    `vals`

    : The list of values of what the user provided, to be compared against the values in `xs`

    `xs`

    : The list of valid values

    # Type

    ```
    assertEachOneOf :: String -> List ComparableVal -> List ComparableVal -> Bool
    ```

    # Examples
    :::{.example}
    ## `lib.asserts.assertEachOneOf` usage example

    ```nix
    let sslLibraries = [ "libressl" "bearssl" ];
    in assertEachOneOf "sslLibraries" sslLibraries [ "openssl" "bearssl" ]
    stderr> error: each element in sslLibraries must be one of [
@@ -63,16 +128,13 @@ rec {
    stderr>   "libressl"
    stderr>   "bearssl"
    stderr> ]
    ```

     Type:
       assertEachOneOf :: String -> List ComparableVal -> List ComparableVal -> Bool
    :::
  */
  assertEachOneOf =
    # The name of the variable the user entered `val` into, for inclusion in the error message
    name:
    # The list of values of what the user provided, to be compared against the values in `xs`
    vals:
    # The list of valid values
    xs:
    assertMsg
    (lib.all (val: lib.elem val xs) vals)
+19 −0
Original line number Diff line number Diff line
@@ -98,6 +98,24 @@ in
          }
        '';
      };

      initialPrefs = mkOption {
        type = types.attrs;
        description = lib.mdDoc ''
          Initial preferences are used to configure the browser for the first run.
          Unlike {option}`programs.chromium.extraOpts`, initialPrefs can be changed by users in the browser settings.
          More information can be found in the Chromium documentation:
          <https://www.chromium.org/administrators/configuring-other-preferences/>
        '';
        default = {};
        example = literalExpression ''
          {
            "first_run_tabs" = [
              "https://nixos.org/"
            ];
          }
        '';
      };
    };
  };

@@ -110,6 +128,7 @@ in
        { source = "${cfg.plasmaBrowserIntegrationPackage}/etc/chromium/native-messaging-hosts/org.kde.plasma.browser_integration.json"; };
      "chromium/policies/managed/default.json" = lib.mkIf (defaultProfile != {}) { text = builtins.toJSON defaultProfile; };
      "chromium/policies/managed/extra.json" = lib.mkIf (cfg.extraOpts != {}) { text = builtins.toJSON cfg.extraOpts; };
      "chromium/initial_preferences" = lib.mkIf (cfg.initialPrefs != {}) { text = builtins.toJSON cfg.initialPrefs; };
      # for google-chrome https://www.chromium.org/administrators/linux-quick-start
      "opt/chrome/native-messaging-hosts/org.kde.plasma.browser_integration.json" = lib.mkIf cfg.enablePlasmaBrowserIntegration
        { source = "${cfg.plasmaBrowserIntegrationPackage}/etc/opt/chrome/native-messaging-hosts/org.kde.plasma.browser_integration.json"; };
+18 −3
Original line number Diff line number Diff line
@@ -66,6 +66,10 @@ in {
            "0.0.0.0@53"
            "::@53"
           ];
          listen-quic = [
            "0.0.0.0@853"
            "::@853"
           ];
          automatic-acl = true;
        };

@@ -129,8 +133,13 @@ in {
          key = "xfr_key";
        };

        remote.primary-quic = {
          address = "192.168.0.1@853";
          key = "xfr_key";
          quic = true;
        };

        template.default = {
          master = "primary";
          # zonefileless setup
          # https://www.knot-dns.cz/docs/2.8/html/operation.html#example-2
          zonefile-sync = "-1";
@@ -139,8 +148,14 @@ in {
        };

        zone = {
          "example.com".file = "example.com.zone";
          "sub.example.com".file = "sub.example.com.zone";
          "example.com" = {
            master = "primary";
            file = "example.com.zone";
          };
          "sub.example.com" = {
            master = "primary-quic";
            file = "sub.example.com.zone";
          };
        };

        log.syslog.any = "debug";
+5 −4
Original line number Diff line number Diff line
{ lib
, mkDerivation
, stdenv
, fetchurl
, cmake
, pkg-config
@@ -10,13 +10,13 @@
, desktop-file-utils
}:

mkDerivation rec {
stdenv.mkDerivation rec {
  pname = "molsketch";
  version = "0.8.0";
  version = "0.8.1";

  src = fetchurl {
    url = "mirror://sourceforge/molsketch/Molsketch-${version}-src.tar.gz";
    hash = "sha256-Mpx4fHktxqBAkmdwqg2pXvEgvvGUQPbgqxKwXKjhJuQ=";
    hash = "sha256-6wFvl3Aktv8RgEdI2ENsKallKlYy/f8Tsm5C0FB/igI=";
  };

  patches = [
@@ -54,5 +54,6 @@ mkDerivation rec {
    license = licenses.gpl2Plus;
    maintainers = [ maintainers.moni ];
    mainProgram = "molsketch";
    platforms = platforms.unix;
  };
}
+2 −2
Original line number Diff line number Diff line
@@ -5,7 +5,7 @@
, ffmpeg
, discord-rpc
, libedit
, libelf
, elfutils
, libepoxy
, libsForQt5
, libzip
@@ -49,7 +49,7 @@ stdenv.mkDerivation (finalAttrs: {
    SDL2
    ffmpeg
    libedit
    libelf
    elfutils
    libepoxy
    libzip
    lua
Loading