22 Jul 2024 |
| silver joined the room. | 15:04:43 |
| ejpcmac joined the room. | 15:08:25 |
| bashfulrobot joined the room. | 17:16:07 |
23 Jul 2024 |
| Ezzobir Bezziou joined the room. | 08:19:01 |
| TommyJ joined the room. | 22:08:40 |
24 Jul 2024 |
| Redstone joined the room. | 10:15:56 |
| quapka4 joined the room. | 12:15:57 |
quapka4 | 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 | * 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 | So, optionally change the source. | 12:20:19 |
quapka4 | Latest meaning the latest version of OpenSSL in nixpkgs, not the HEAD of the repo. | 12:21:38 |
quapka4 | So, I don't think I want { version ? "master" } . | 12:22:02 |
quapka4 | 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 | 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 | Feels okay, maybe I just question it because I did it the first time :D | 13:43:14 |
| @kaleocheng:matrix.org left the room. | 13:59:52 |
Ramses 🇵🇸 | That's how I do it all the time as well | 14:06:26 |
Mindavi | These questions are more suitable for nixpkgs channels since they involve nixpkgs patterns | 16:31:15 |
| tazv joined the room. | 21:08:41 |
| @lambadada:matrix.org left the room. | 23:57:14 |
25 Jul 2024 |
| @fluffeh:matrix.org left the room. | 01:02:07 |
mr-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 | 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 | * 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 | * 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 |
Tranquil Ity | Please don't use threads, they break some clients (such as Element Web) | 05:18:34 |
Tranquil Ity | With that said | 05:26:22 |
Tranquil Ity | Download image.png | 05:26:23 |
Tranquil Ity | Does this answer your Q? | 05:26:26 |
Tranquil Ity | Download image.png | 05:31:11 |