!tDnwWRNkmmYtMXfaZl:nixos.org

Nix Language

1518 Members
Nix programming language267 Servers

You have reached the beginning of time (for this room).


SenderMessageTime
22 Jul 2024
@silver:matrix.brendan.iesilver joined the room.15:04:43
@jpc:ejpcmac.netejpcmac joined the room.15:08:25
@bashfulrobot.:matrix.orgbashfulrobot joined the room.17:16:07
23 Jul 2024
@ezzobirbezziou:matrix.orgEzzobir Bezziou joined the room.08:19:01
@buttars:matrix.orgTommyJ joined the room.22:08:40
24 Jul 2024
@redstone-menace:matrix.orgRedstone joined the room.10:15:56
@quapka4:matrix.orgquapka4 joined the room.12:15:57
@quapka4:matrix.orgquapka4

Hi folks, how to default to latest version of package if version is not passed, something like this:

openssl = { version }: pkgs.openssl.overrideAttrs (final: prev: {
  if version {
    src = {
      rev = "${version}";
};
});
12:19:46
@quapka4:matrix.orgquapka4 *

Hi folks, how to default to latest version of package if version is not passed, something like this:

openssl = { version }: pkgs.openssl.overrideAttrs (final: prev: {
  if version {
    src = {
      rev = "${version}";
};
});
12:19:52
@quapka4:matrix.orgquapka4So, optionally change the source.12:20:19
@quapka4:matrix.orgquapka4 Latest meaning the latest version of OpenSSL in nixpkgs, not the HEAD of the repo. 12:21:38
@quapka4:matrix.orgquapka4 So, I don't think I want { version ? "master" }. 12:22:02
@quapka4:matrix.orgquapka4

Ah:

          src = if version != "" then pkgs.fetchurl {
            url = "https://www.openssl.org/source/openssl-${version}.tar.gz";
            hash = hash;
          } else
          prev.src;

does the job.

13:27:54
@quapka4:matrix.orgquapka4

Btw. regarding override and overrideAttrs is there some common patterns to follow? I need both so did something like:

package = ( pkgs.package.override { param = 1 } ).overrideAttrs (final: prev: { ... });
13:42:53
@quapka4:matrix.orgquapka4Feels okay, maybe I just question it because I did it the first time :D13:43:14
@kaleocheng:matrix.org@kaleocheng:matrix.org left the room.13:59:52
@rvdp:infosec.exchangeRamses 🇵🇸That's how I do it all the time as well14:06:26
@rick:matrix.ciphernetics.nlMindaviThese questions are more suitable for nixpkgs channels since they involve nixpkgs patterns16:31:15
@tazv:matrix.orgtazv joined the room.21:08:41
@lambadada:matrix.org@lambadada:matrix.org left the room.23:57:14
25 Jul 2024
@fluffeh:matrix.org@fluffeh:matrix.org left the room.01:02:07
@mr-qubo:matrix.orgmr-qubo

How can I map over types.attrsOf option in config. Example:

{ config, lib, ... }:
with lib;

{
  options = {
    users = mkOption {
      type = types.attrsOf (types.submodule ({ ... }: {
        options = {
          foo = mkEnableOption "foo";
          bar = mkEnableOption "bar";
        };
      }));
      default = {};
    };
  };
}

How can I do something like users.<user>.foo = mkIf config.users.<user>.bar true for every <user>?

03:17:19
@mr-qubo:matrix.orgmr-qubo

I've tried

    users = flip mapAttrs config.users (name: user: {
      foo = mkIf user.bar true;
    });

but this gives me infinite recursion error.

03:24:07
@mr-qubo:matrix.orgmr-qubo *

How can I map over types.attrsOf option in config. Example:

{ config, lib, ... }:
with lib;

{
  options = {
    users = mkOption {
      type = types.attrsOf (types.submodule ({ ... }: {
        options = {
          foo = mkEnableOption "foo";
          bar = mkEnableOption "bar";
        };
      }));
      default = {};
    };
  };
}

How can I do something like users.<user>.foo = mkIf config.users.<user>.bar true for every <user>?

03:24:22
@mr-qubo:matrix.orgmr-qubo *

I've tried

    users = flip mapAttrs config.users (name: user: {
      foo = mkIf user.bar true;
    });

but this gives me infinite recursion error.

03:24:27
@ity:itycodes.orgTranquil ItyPlease don't use threads, they break some clients (such as Element Web)05:18:34
@ity:itycodes.orgTranquil ItyWith that said05:26:22
@ity:itycodes.orgTranquil Ityimage.png
Download image.png
05:26:23
@ity:itycodes.orgTranquil ItyDoes this answer your Q?05:26:26
@ity:itycodes.orgTranquil Ityimage.png
Download image.png
05:31:11

Show newer messages


Back to Room ListRoom Version: 6