| 8 Sep 2021 |
figsoda | guess so | 12:05:24 |
cdepillabout | In reply to @cdepillabout:matrix.org
How can I use a quoted let binding?
For instance, how would I use assert after the in:
let "assert" = 3; in ...
I posted this question on Discourse in case anyone is interested in following along: https://discourse.nixos.org/t/how-to-use-quoted-let-bindings/14925 | 12:47:07 |
polykernel | I may be wrong but I don't think there is any way to override top-level keywords unless you use scopedImport. | 14:06:58 |
polykernel | * I may be wrong but I don't think there is any way to override top-level keywords. | 14:07:25 |
ilkecan | Are builtins such as throw s, trace e1 e2 etc. considered an expression in Nix? | 15:11:38 |
sterni | yes you can shadow them even | 15:14:03 |
sterni | but assert has special syntax, so it is handled specially | 15:14:16 |
ilkecan | I see, thank you. | 15:31:18 |
| 9 Sep 2021 |
cdepillabout | In reply to @polykernel:kde.org I may be wrong but I don't think there is any way to override top-level keywords. Just for clarification, I'm not trying to override assert in my example, I'm just trying to use a binding that happens to be called assert.
I'd be happy for an example of how to use any sort of quoted binding. For instance:
let "this is an identifier with spaces" = 3; in ...
| 02:38:57 |
cdepillabout | In reply to @polykernel:kde.org I may be wrong but I don't think there is any way to override top-level keywords. * Just for clarification, I'm not trying to override the assert keyword in my example, I'm just trying to use a binding that happens to be called assert.
I'd be happy for an example of how to use any sort of quoted binding. For instance:
let "this is an identifier with spaces" = 3; in ...
| 11:11:03 |
sterni | Behold variable function parameter count trick in nix:
> concatMany = s: { inherit s; __toString = self: self.s; __functor = self: s': self // { s = self.s + s'; }; }
> "${concatMany "foo" " " "bar"}"
"foo bar"
> "${concatMany "yes" ", " "you " "saw" " it" "!"}"
"yes, you saw it!"
| 21:05:13 |
sterni | A printf type function is also possible, but boring in comparison because the format string mandates the number of arguments so you don't need to need the dance of return val which can be called and is a string | 21:06:17 |
sterni | * A printf type function is also possible, but boring in comparison because the format string mandates the number of arguments so you don't need to need the dance of return val which can be called and is a "string" | 21:06:22 |
infinisil | sterni: Niiiice | 21:35:41 |
infinisil | Never saw __toString and __functor be combined in this way | 21:36:13 |
sterni | Simple printf implementation with only %s and %%:
{ lib, ... }:
formatString:
let
tokenWithArg = token: builtins.elem token [
"%s"
];
tokens = lib.flatten (builtins.split "(%.)" formatString);
argsNeeded = builtins.length (builtins.filter tokenWithArg tokens);
format = args: (builtins.foldl' ({ out ? "", argIndex ? 0 }: token: {
argIndex = argIndex + (if tokenWithArg token then 1 else 0);
out =
/**/ if token == "%s" then out + builtins.elemAt args argIndex
else if token == "%%" then out + "%"
else out + token;
}) {} tokens).out;
accumulateArgs = argCount: args:
if argCount > 0
then arg: accumulateArgs (argCount - 1) (args ++ [ arg ])
else format args;
in
accumulateArgs argsNeeded []
| 21:37:13 |
| 10 Sep 2021 |
| shekhinah left the room. | 05:12:13 |
| 11 Sep 2021 |
| Marillindiƫ joined the room. | 05:26:50 |
| MarkN joined the room. | 14:48:17 |
| yusdacra changed their profile picture. | 16:32:11 |
| 13 Sep 2021 |
| jbedo joined the room. | 03:41:22 |
| jbedo left the room. | 03:41:24 |
| jbedo changed their display name from vk3wtf to jbedo. | 03:41:29 |
| jbedo changed their display name from jbedo to vk3wtf. | 05:57:10 |
| jbedo changed their display name from vk3wtf to jbedo. | 05:57:56 |
efim | Can anyone help me I'm on nix-os trying debug & create sample configuration similar to this one https://github.com/efim/nix-searx-container-example/blob/master/non-flake-config.nix
but for "searxng", so that searx plugins would be installed just as easily
on previous week this builting.fetchGit worked and worked great (lib.fetchFromGitHub - infinitely recursed, it seems because i've been importing overlays to pkgs from flakes, and to get flakes final lib has to be built, etc)
but today then I try to do
sudo nixos-container update bar --config-file non-flake-config.nix I get prompted for "email+password" authentication on github And even if I provide correct auth - I get error
remote: Support for password authentication was removed on August 13, 2021. Please use a personal access token instead. Over weekend I've been refactoring NixOS config, but have no idea what could have caused it
When I try to evaluate statement with lib.fetchGit in nix-repl it works well! and git fetch --all asks for my ssh key, not email =C ( maybe @gytis would know?)
| 12:24:44 |
efim | * Can anyone help me I'm on nix-os trying debug & create sample configuration similar to this one https://github.com/efim/nix-searx-container-example/blob/master/non-flake-config.nix
but for "searxng", so that searx plugins would be installed just as easily
on previous week this builting.fetchGit worked and worked great (lib.fetchFromGitHub - infinitely recursed, it seems because i've been importing overlays to pkgs from flakes, and to get flakes final lib has to be built, etc)
but today then I try to do
sudo nixos-container update bar --config-file non-flake-config.nix I get prompted for "email+password" authentication on github And even if I provide correct auth - I get error
remote: Support for password authentication was removed on August 13, 2021. Please use a personal access token instead. Over weekend I've been refactoring NixOS config, but have no idea what could have caused it
When I try to evaluate statement with lib.fetchGit in nix-repl it works well! and git fetch --all asks for my ssh key, not email =C ( maybe @gytis would know?)
| 12:25:08 |
efim | * Can anyone help me I'm on nix-os trying debug & create sample configuration similar to this one https://github.com/efim/nix-searx-container-example/blob/master/non-flake-config.nix
but for "searxng", so that searx plugins would be installed just as easily
on previous week this builting.fetchGit worked and worked great (lib.fetchFromGitHub - infinitely recursed, it seems because i've been importing overlays to pkgs from flakes, and to get flakes final lib has to be built, etc)
but today then I try to do
sudo nixos-container update bar --config-file non-flake-config.nix I get prompted for "email+password" authentication on github And even if I provide correct auth - I get error
remote: Support for password authentication was removed on August 13, 2021. Please use a personal access token instead. Over weekend I've been refactoring NixOS config, but have no idea what could have caused it
When I try to evaluate statement with lib.fetchGit in nix-repl it works well! and git fetch --all asks for my ssh key, not email =C
| 12:25:43 |
efim | I guess this is solved: I think the repo is public, but there's a mistake in the link
so fetcher tries to check whether there's some private repo with that name | 12:33:54 |
| legendofmiracles changed their profile picture. | 23:49:09 |