| 9 Aug 2023 |
Lily Foster | Yeah, that makes sense I suppose | 23:45:36 |
Lily Foster | In reply to @lily:lily.flowers Okay I made a thing for passing in an environment variable that looks like NIX_NPM_TOKENS='{"regsistry.fontawesome.com":"token"}'. Do you think you could apply this patch to your nixpkgs and see if you can set NIX_NPM_TOKENS on your builder/nix daemon? https://github.com/lilyinstarlight/nixpkgs/compare/5a8e9243812ba528000995b294292d3b5e120947...24f435dd88b47f53011bc1f296fd0347699ef451.diff Oh also NIX_NPM_TOKENS needs to be set on the nix daemon if running Nix in multi-user mode (the default unless you are running as root user). I will leave it up to you on how to do that, but in general it will eventually end up being some systemd override to add Environment=NIX_NPM_TOKENS={...} (and overrides usually go in somewhere like /etc/systemd/system/nix-daemon.service.d/) | 23:47:45 |
countoren | I was thinking actually clone me a copy apply the diff and add it to my flake | 23:48:44 |
countoren | as ref | 23:48:52 |
countoren | * as absulte pat | 23:49:02 |
Lily Foster | For nixpkgs, yeah that's probably easiest | 23:49:08 |
countoren | * as absolute pat | 23:49:14 |
Lily Foster | I'm just saying to pass in the privilege token you'll need to get it into the build environment a bit awkwardly (unfortunately) | 23:49:25 |
countoren | its been a while since I worked on the actual nixpkgs. so it clean copy | 23:49:52 |
countoren | btw another way if you a branch or fork i can point the flake directly to it | 23:50:52 |
Lily Foster | Oh yeah, sure! github:lilyinstarlight/nixpkgs/feature/prefetch-npm-deps-tokens | 23:51:40 |
countoren | the magic of flake... | 23:54:02 |
countoren | it must be on daemon? there is no way to specify it on the project's flake itself? | 23:59:05 |
| 10 Aug 2023 |
Lily Foster | Tokens are secrets, so it's not something we usually do in nixpkgs. Afaik what we usually do when fetcher info needs to be propagated to the builder we just let it impurely inherit env vars from the builder (which is admittedly very hacky and unintuitive and annoying, so if anyone knows another way fetcher secrets are propagated in nixpkgs I would be open to implementing an alternative as well) | 00:05:18 |
countoren | I w | 00:06:11 |
countoren | yes it make sense but It might be fine to have a quick way if someone want to define them the uncleaner way they can with a warning maybe | 00:08:11 |
countoren | well I guess if you really want you can always hack a quick writeshellscript to change you secrets on the service | 00:11:12 |
countoren | but for beginners it might not be that straightforward | 00:11:49 |
countoren | Lily Foster: so /etc/systemd/system/nix-daemon.service.d/overrides.conf is a symlink to the store. I could overwrite with my own copy it and add the env var put is it correct? | 00:22:02 |
countoren | * Lily Foster: so /etc/systemd/system/nix-daemon.service.d/overrides.conf is a symlink to the store. I could overwrite with my own copy it and add the env var, but is it correct? | 00:22:13 |
countoren | I guess ill go with systemctl set-environment | 00:32:37 |
Lily Foster | In reply to @countoren:matrix.org Lily Foster: so /etc/systemd/system/nix-daemon.service.d/overrides.conf is a symlink to the store. I could overwrite with my own copy it and add the env var, but is it correct? You can also add a new file in that dir | 00:35:57 |
Lily Foster | In reply to @countoren:matrix.org I guess ill go with systemctl set-environment But that works too :) | 00:36:02 |
countoren | so given this npmrc for my token now:
@fortawesome:registry=https://npm.fontawesome.com/
//npm.fontawesome.com/:_authToken=11111111111111111111111111111111111111111111111
| 00:36:45 |
Lily Foster | In reply to @me:indeednotjames.com alright, thanks! :) Yep, it looks like nodejs finally released the sources a couple hours ago and marsam has already opened https://github.com/NixOS/nixpkgs/pull/248230 | 00:36:50 |
Lily Foster | In reply to @countoren:matrix.org
so given this npmrc for my token now:
@fortawesome:registry=https://npm.fontawesome.com/
//npm.fontawesome.com/:_authToken=11111111111111111111111111111111111111111111111
Yeah that would become NIX_NPM_TOKENS={"npm.fontawesome.com":"111111111111111111111"} in the environment for the fetcher | 00:37:59 |
countoren | In reply to @lily:lily.flowers Yeah that would become NIX_NPM_TOKENS={"npm.fontawesome.com":"111111111111111111111"} in the environment for the fetcher thank you ill do it right, didnt know about the new file might try it too | 00:39:27 |
countoren | changed and restarted the deamon. do you know a way to check if it got it? | 00:45:31 |
Lily Foster | Hmmm, I'm not sure other than saying to try a build | 00:46:03 |
countoren | ok | 00:46:16 |