27 Jul 2024 |
rendakuenthusiast⚡️ | why doesn't string interpolation work with integers? | 22:40:20 |
rendakuenthusiast⚡️ | having to manually call (toString port-number) is kinda inconveneint | 22:40:38 |
Tranquil Ity | In reply to @test-user:c.imperishable.name why doesn't string interpolation work with integers? What would you want it to do ? JavaScript? | 22:41:14 |
rendakuenthusiast⚡️ | basically have the "string-${variable}syntax automatically call toString` if necessary | 22:41:37 |
rendakuenthusiast⚡️ | which is what many languages with string interpolation syntax do | 22:41:51 |
rendakuenthusiast⚡️ | * basically have the "string-${variable}" syntax automatically calltoString if necessary | 22:42:10 |
Matt Sturgeon | There's some precedent for this already: paths and derivations are stringified when used with string interpolation.
AFAIK most languages that have string formatting and/or string interpolation automatically stringify non-string values?
I get why you may want concatenation to be explicit about the type, but interpolation feels different 🤔 | 22:46:21 |
Tranquil Ity | In reply to @test-user:c.imperishable.name basically have the "string-${variable}" syntax automatically calltoString if necessary Ah | 22:54:39 |
rendakuenthusiast⚡️ | In reply to @mattsturg:matrix.org There's some precedent for this already: paths and derivations are stringified when used with string interpolation. AFAIK most languages that have string formatting and/or string interpolation automatically stringify non-string values? I get why you may want concatenation to be explicit about the type, but interpolation feels different 🤔 in particular interpolation for integers, which should be very easy to do | 22:55:19 |
28 Jul 2024 |
Kamilla 'ova | Hi, can someone explain this behavior? | 18:54:00 |
Kamilla 'ova | Download image.png | 18:54:08 |
emily | oh boy | 19:16:32 |
emily | that's not the only platform divergence, try builtins.split "" 🙃 | 19:16:49 |
emily | but this might be a new one | 19:16:57 |
emily | you might want to report it upstream | 19:47:21 |
29 Jul 2024 |
| andmuz joined the room. | 00:49:46 |
| @rayne:spooky.computer left the room. | 03:38:31 |
| @kenzie:matrix.kenzi.dev left the room. | 06:57:49 |
| Kodin joined the room. | 07:04:18 |
| @mariosangiorgio:matrix.org left the room. | 07:21:39 |
| Travis joined the room. | 15:04:04 |
| @minec:ins4.xyz joined the room. | 16:41:04 |
infinisil | Neat find! | 23:10:50 |
30 Jul 2024 |
quapka4 | Hi folks, let's say I am building a derivation that depends on many pkgs and I wanna be able to build the final derivation with various versions of the dependencies. What is a clean way to do it? I was thinking something like:
builder = { pkg1 ? { version = null; hash = null;} pkg2 ? { version = null; hash = null; ... }: {
...
}
| 09:08:44 |
quapka4 | * Hi folks, let's say I am building a derivation that depends on many pkgs and I wanna be able to build the final derivation with various versions of the dependencies. What is a clean way to do it? I was thinking something like:
builder = { pkg1 ? { version = null; hash = null;} pkg2 ? { version = null; hash = null; ... }: {
...
}
| 09:08:48 |
quapka4 | And then if version of a given package is provided I will rebuild it. | 09:09:09 |
| raf changed their display name from notashelf to raf. | 10:04:55 |
| raf changed their display name from raf to NotAShelf. | 10:05:49 |
Matt Sturgeon | Normally you would do this using the callPackage pattern where the various dependencies are inputs to your derivation function.
When you call your derivation using callPackage any arguments will default to pkgs.* if not explicitly passed in.
# A file using your package
lib.callPackage ./package.nix { /* explicit args (optional) */ };
# package.nix
{
lib,
runCommand,
some-dep,
other-dep,
}:
runCommand "name" {} ''
echo "Hello, world!" > "$out"
''
# Some other file that overrides a dep
lib.callPackage ./package.nix {
inherit some-dep;
}
| 10:26:26 |
Matt Sturgeon | * Normally you would do this using the callPackage pattern where the various dependencies are inputs to your derivation function.
When you call your derivation using callPackage any arguments will default to pkgs.* if not explicitly passed in.
# A file using your package
lib.callPackage ./package.nix { /* explicit args (optional) */ };
# Some other file that overrides a dep
lib.callPackage ./package.nix {
inherit some-dep;
}
# package.nix
{
lib,
runCommand,
some-dep,
other-dep,
}:
runCommand "name" {} ''
echo "Hello, world!" > "$out"
''
| 10:27:04 |