16 Feb 2025 |
samueldr | maybe file two, if I understand what you did | 03:31:04 |
samueldr | antifuchs: thinking out loud, you don't need to do anything about it... I'll probably then import the support tooling to get the README updated with the options, automatically, as found here, now that there will be options https://github.com/samueldr/more-space-action/blob/latest/support/update-readme.rb | 03:33:56 |
antifuchs | That’s a fantastic idea, I manually updated that but if there’s a script it’s even better | 03:39:16 |
antifuchs | Also, yep, one pr per option sounds right | 03:41:00 |
Charles | makeScopedPackagesFromDirectoryRecursive = newScope: directory:
nixpkgs.lib.customisation.makeScope newScope (scope:
nixpkgs.lib.filesystem.packagesFromDirectoryRecursive {
inherit directory;
callPackage = fn: args:
scope.callPackage
fn
(args // { sprinkle = self; });
}
);
not to interrupt but i have to share this extremely long function name i just wrote
| 03:41:49 |
Charles | (oh darn the attribute set merge thingy does not do what i had hoped it would) | 03:53:37 |
antifuchs | Hm, maybe you need to use withCallPackage or whatever it’s called | 03:54:14 |
Charles | i was gonna go for builtins.functionArgs and doing it manually, but that sounds possibly better | 03:54:38 |
antifuchs | nixpkgs.lib.callPackageWith, that’s the o e | 03:55:00 |
antifuchs | * nixpkgs.lib.callPackageWith, that’s the one | 03:55:04 |
| * Charles RsTFM | 03:55:23 |
antifuchs | I’m not sure it’s documented 😭 | 03:55:44 |
Charles | https://nixos.org/manual/nixpkgs/unstable/#function-library-lib.customisation.callPackageWith ? | 03:56:13 |
antifuchs | Hah, oops! There we go | 03:56:23 |
raitobezarius | In reply to @charles:computer.surgery i was gonna go for builtins.functionArgs and doing it manually, but that sounds possibly better This man is going to reinvent nixpkgs if left alone | 03:56:42 |
Charles | yes | 03:56:51 |
raitobezarius | 2muchinthefuture | 03:57:08 |
Charles | in reality i'm just trying to make my dotfiles good | 03:57:34 |
Charles | using my new sprinkles thingy | 03:58:00 |
raitobezarius | Excited for the sprinkles RFC | 04:00:13 |
Charles | i briefly considered trying to write a lix plugin that provided a builtins.newSprinkle function | 04:00:48 |
Charles | also i'm not sure if callPackageWith fits the bill here because i need to combine it with the scope.callPackage too somehow | 04:03:01 |
antifuchs | Ah, hmm, yeah that’s an issue | 04:06:29 |
antifuchs | Oh wait, isn’t example 254 exactly that? | 04:07:53 |
Charles | kinda | 04:08:34 |
antifuchs | ETOOFUNCTIONAL for my brain atm | 04:08:37 |
Charles | 254 uses callPackageWith to construct the value for newScope , but i want to use an existing other value for that | 04:09:10 |
Charles | e.g. nixpkgs.newScope | 04:09:15 |
Charles | so... this works:
callPackage = fn: args:
scope.callPackage
fn
(args // (
let
loadedFn = if builtins.isFunction fn
then fn
else if builtins.isPath fn
then import fn
else builtins.throw "???";
requiresSprinkle = builtins.hasAttr
"sprinkle"
(builtins.functionArgs loadedFn);
in
if requiresSprinkle
then { sprinkle = self; }
else {}
));
| 04:24:48 |
Charles | now i'm getting infinite recursion presumably because i have packages like { foo }: (foo.override { bar = true; }) that retain the same name in my newly created scope from their original scope, but what's weird is that this wasn't happening before | 04:27:35 |