Skip to content
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

Add NixOS installation method to doc #5757

Merged
merged 3 commits into from
Feb 6, 2023
Merged

Add NixOS installation method to doc #5757

merged 3 commits into from
Feb 6, 2023

Conversation

schalkms
Copy link
Member

@schalkms schalkms commented Feb 4, 2023

No description provided.

@codecov
Copy link

codecov bot commented Feb 4, 2023

Codecov Report

Merging #5757 (df04a86) into main (488d0b8) will decrease coverage by 0.05%.
The diff coverage is n/a.

@@             Coverage Diff              @@
##               main    #5757      +/-   ##
============================================
- Coverage     84.52%   84.48%   -0.05%     
- Complexity     3731     3742      +11     
============================================
  Files           544      546       +2     
  Lines         12759    12791      +32     
  Branches       2232     2233       +1     
============================================
+ Hits          10785    10806      +21     
- Misses          864      869       +5     
- Partials       1110     1116       +6     
Impacted Files Coverage Δ
...turbosch/detekt/rules/style/UnusedPrivateMember.kt 92.22% <0.00%> (-0.64%) ⬇️
...in/kotlin/io/github/detekt/report/xml/XmlEscape.kt 65.97% <0.00%> (ø)
.../arturbosch/detekt/core/util/PerformanceMonitor.kt 85.71% <0.00%> (ø)
...rturbosch/detekt/rules/style/StyleGuideProvider.kt 100.00% <0.00%> (ø)
...h/detekt/core/baseline/IndentingXMLStreamWriter.kt 56.33% <0.00%> (ø)
...rbosch/detekt/rules/style/UnusedPrivateProperty.kt 92.72% <0.00%> (ø)
...b/arturbosch/detekt/rules/style/UnusedParameter.kt 77.35% <0.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

### NixOS

```sh
nix-shell -p detekt -I nixpkgs=https://github.com/NixOS/nixpkgs/archive/f80ac848e3d6f0c12c52758c0f25c10c97ca3b62.tar.gz --command 'detekt --version' [detekt_version]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not familiar with Nix - does the hash in the filename have to be updated with every detekt release? If so, is there a way to remove that from this command, because having to update this for every release may be a bit of a hassle.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just saw on Slack in our #detekt channel that @mdr added detekt as a nix package.
@mdr do you know whether the hash has to be updated with each and every detekt release?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mdr do you know whether the hash has to be updated with each and every detekt release?

(With the caveat I'm a Nix beginner!) Yes - if you specify a specific revision as above then you'd always get the same version of Detekt, so you'd have to update to get a more recent version of Detekt. You can just reference the detekt package unqualified, e.g. with nix-shell -p detekt - and then you'll get the Detekt version associated with the Nix channel you're using. If you're using the stable channel, that might be a few months out of date (and right now, detekt is too new to be in a stable Nix channel).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, then I'll change the script in the docs to be more generic, like this.

nixpkgs=https://github.com/NixOS/nixpkgs/archive/[hash].tar.gz

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess at some point when it's in stable channel we can simplify the command. But this is good in the meantime.

Where do people get the hash though? Is there a link we can include in the instructions?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can grab a commit hash from the Nix status page (for the nixpkgs-unstable channel). It does feel kinda awkward - I don't know if there's a way you can directly reference the latest nixpkgs-unstable channel directly in the command.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you have added the unstable channel via nix-channel, you can run: nix-shell -I nixpkgs=channel:nixpkgs-unstable -p detekt

@3flex 3flex merged commit e57378f into main Feb 6, 2023
@3flex 3flex deleted the schalkms-NixOS branch February 6, 2023 21:14
@cortinico
Copy link
Member

I've backported it here #5776

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants