-
-
Notifications
You must be signed in to change notification settings - Fork 14.3k
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
kns: init @ 86502949c31432bd95895cfb26d1c5893c533d5c #193995
Conversation
Result of 1 package failed to build:
|
i had to change the EDIT:
i just realized that this won't work because every new commit will result in a new sha256 sum, breaking this pkg as a result. |
sha256 = "sha256-zcJaH+Uyc/rCDRlQi+lSKaG7z4VWlNZ13klDnvL3Jgc="; | ||
}; | ||
|
||
strictDeps = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
buildInputs = [ fzf kubectl ];
@crutonjohn can you take a look at the changes I suggested? I'd be happy to take over the PR if you'd like too. |
these all look good to me, I've been on holiday with my family but happy to take care of this sometime this week. |
awesome, looking forward to getting rid of this from all my shell.nix/flake.nix files :D |
Co-authored-by: Manuel Mendez <[email protected]>
Co-authored-by: Manuel Mendez <[email protected]>
Co-authored-by: Manuel Mendez <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, probably want to retitle the PR to kns: init @ 8650294
though
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi !
Thanks for your contribution.
I've left some comments, left me know if this is clear enough.
Also, there should only be 2 commits in this PR:
- 1 commit for adding you to maintainers:
maintainers: add crutonjohn
- 1 commit for the rest:
kns: init at unstable-2022-04-25
Thanks!
@@ -0,0 +1,35 @@ | |||
{ stdenvNoCC, lib, fetchFromGitHub, fzf, kubectl }: | |||
|
|||
stdenvNoCC.mkDerivation rec { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should use the finalAttrs
pattern here.
The finalAttrs
pattern will let you remove the rec
keyword (see its implementation in Nix).
Why is this pattern preferred to rec
?
Let's take this simple code example:
mkDerivation rec {
foo = 1;
bar = foo + 1;
}
and then .overrideAttrs(old: { foo = 2; })
, you'll get { foo = 2; bar = 2; }
while with finalAttrs
pattern, it would work correctly because it's a real fixed point.
Let me share a couple of useful links regarding the finalAttrs
pattern:
- History: https://discourse.nixos.org/t/avoid-rec-expresions-in-nixpkgs/8293
- Documentation: https://nixos.org/manual/nixpkgs/unstable/#mkderivation-recursive-attributes
- Recent example of implementation: https://github.com/NixOS/nixpkgs/compare/17f96f7b978e61576cfe16136eb418f74fab9952..9e6ea843e473d34d4f379b8b0d8ef0425a06defe
Feel free to reach out if you need some assistance.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I get rid of repo = pname
then I don't need rec
at all, nor finalAttrs, 2 birds with one stone!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bingo ! :)
|
||
src = fetchFromGitHub { | ||
owner = "blendle"; | ||
repo = pname; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don't use this.
repo = pname;
is nice for DRY but creates a binding that goes too far.
See further information about this here: nix-community/nixpkgs-lint#21
@crutonjohn do you have the bw to apply @drupol's suggestions? If not let me know and I'll take over (alas in a separate PR). |
yeah ive been back and forth traveling for work so im tapped out. would be incredibly grateful if you could just knock it out. 🙏 |
@mmlb will you tag me in the new PR plz |
Description of changes
Add new package for
kns
the easy kubernetes namespace switcher. Upstream can be found here: https://github.com/blendle/knskns
is a shell script that usesfzf
to help navigate namespaces within a kubernetes cluster.I used the existing kubectl-node-shell to base my work on, as they are both fancy bash scripts.
Things done
sandbox = true
set innix.conf
? (See Nix manual)nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)nixos/doc/manual/md-to-db.sh
to update generated release notes