-
Notifications
You must be signed in to change notification settings - Fork 108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pass 'self' to lib #169
Comments
I would be somehow in favor of this. (resolve there, so we can discuss here) |
Yup your PR was what gave me the idea, and I think it would simplify some other lib functions as well. |
Tested it with this patch
diff --git a/flake.nix b/flake.nix
index ad39936..b1720b5 100644
--- a/flake.nix
+++ b/flake.nix
@@ -36,7 +36,7 @@
@@ -57,7 +57,7 @@
diff --git a/lib/default.nix b/lib/default.nix -{ self }: And the configurations evaluated okay. |
I've thought about this as well. Was also wondering if passing self as a specialArg would be useful in general. If we do this, we should probably do that as well. Although, for clarity we should probably rename it on passing, something like: |
Thats a good idea. If you do that I'll drop the multiPkgs module argument. Since you could just use And actually it could obsolete the hosts module arg since other configs could be accessed with self.nixosConfigurations. But I'm not sure since hosts is still easier to access and could prevent possible infinite recursion errors. |
We'll probably want to levarage the new test infrastructure to ensure there is no infinite recursion. |
It is generally useful to acess the top level flake from library functions or hosts. This not only simplifies the mental model and code but also provides additional context and not least a handle to the repo source code in the nix store. closes divnix#169
It is generally useful to acess the top level flake from library functions or hosts. This not only simplifies the mental model and code but also provides additional context and not least a handle to the repo source code in the nix store. closes divnix#169
It is generally useful to acess the top level flake from library functions or hosts. This not only simplifies the mental model and code but also provides additional context and not least a handle to the repo source code in the nix store. closes divnix#169
It is generally useful to acess the top level flake from library functions or hosts. This not only simplifies the mental model and code but also provides additional context and not least a handle to the repo source code in the nix store. closes divnix#169
closed by #168 |
For os.mkPkgs and os.mkPackages, self is passed to them as a function argument. But why not just pass self to lib/default.nix and make it available for all lib functions?
So you can just call
os.mkPkgs
without any arguments. Andos.mkPackages
can just be passedpkgs
.The text was updated successfully, but these errors were encountered: