-
-
Notifications
You must be signed in to change notification settings - Fork 13.7k
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
Changes from all commits
ee4b487
31dc9f8
af41e1d
c091be9
272b7cf
013daa1
3524002
161f8ce
49eee63
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2992,6 +2992,12 @@ | |
fingerprint = "2017 E152 BB81 5C16 955C E612 45BC C1E2 709B 1788"; | ||
}]; | ||
}; | ||
crutonjohn = { | ||
email = "[email protected]"; | ||
github = "crutonjohn"; | ||
githubId = 19677342; | ||
name = "Curtis Ray John"; | ||
}; | ||
cryptix = { | ||
email = "[email protected]"; | ||
github = "cryptix"; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
{ stdenvNoCC, lib, fetchFromGitHub, fzf, kubectl }: | ||
|
||
stdenvNoCC.mkDerivation rec { | ||
pname = "kns"; | ||
version = "unstable-2022-04-25"; | ||
|
||
src = fetchFromGitHub { | ||
owner = "blendle"; | ||
repo = pname; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please don't use this.
See further information about this here: nix-community/nixpkgs-lint#21 |
||
rev = "86502949c31432bd95895cfb26d1c5893c533d5c"; | ||
sha256 = "sha256-8AR/fEKPAfiKCZrp/AyJo3Ic8dH7SfncYZSdQA2GywQ="; | ||
}; | ||
|
||
strictDeps = true; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
buildInputs = [ fzf kubectl ]; | ||
|
||
installPhase = '' | ||
runHook preInstall | ||
|
||
substituteInPlace bin/kns bin/ktx --replace fzf ${fzf}/bin/fzf --replace kubectl ${kubectl}/bin/kubectl | ||
install -D -m755 -t $out/bin bin/kns bin/ktx | ||
|
||
runHook postInstall | ||
''; | ||
|
||
meta = with lib; { | ||
description = "Kubernetes namespace switcher"; | ||
homepage = "https://github.com/blendle/kns"; | ||
license = licenses.isc; | ||
maintainers = with maintainers; [ crutonjohn ]; | ||
platforms = platforms.linux; | ||
}; | ||
} | ||
|
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 therec
keyword (see its implementation in Nix).Why is this pattern preferred to
rec
?Let's take this simple code example:
and then
.overrideAttrs(old: { foo = 2; })
, you'll get{ foo = 2; bar = 2; }
while withfinalAttrs
pattern, it would work correctly because it's a real fixed point.Let me share a couple of useful links regarding the
finalAttrs
pattern: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 needrec
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 ! :)