mirror of
https://github.com/nix-community/home-manager.git
synced 2026-10-03 12:09:19 +00:00
This change converts redundant attribute assignments of the form `a = a;` or `a = someSet.a;` into cleaner `inherit` statements. This reduces verbosity and follows common Nix style for bringing attributes into scope. Statix Codes: W03 (manual_inherit), W04 (manual_inherit_from) Also include statix and the rule in our configuration.
41 lines
1.1 KiB
Nix
41 lines
1.1 KiB
Nix
{ pkgs, ... }:
|
|
|
|
let
|
|
credentials = [
|
|
{
|
|
realm = "Sonatype Nexus Repository Manager";
|
|
host = "example.com";
|
|
user = "user";
|
|
passwordCommand = "echo password";
|
|
}
|
|
{
|
|
realm = "Sonatype Nexus Repository Manager X";
|
|
host = "v2.example.com";
|
|
user = "user1";
|
|
passwordCommand = "echo password1";
|
|
}
|
|
];
|
|
expectedCredentialsSbt = pkgs.writeText "credentials.sbt" ''
|
|
import scala.sys.process._
|
|
lazy val credential_0 = "echo password".!!.trim
|
|
ThisBuild / credentials += Credentials("Sonatype Nexus Repository Manager", "example.com", "user", credential_0)
|
|
lazy val credential_1 = "echo password1".!!.trim
|
|
ThisBuild / credentials += Credentials("Sonatype Nexus Repository Manager X", "v2.example.com", "user1", credential_1)
|
|
'';
|
|
credentialsSbtPath = ".sbt/1.0/credentials.sbt";
|
|
in
|
|
{
|
|
config = {
|
|
programs.sbt = {
|
|
enable = true;
|
|
inherit credentials;
|
|
package = pkgs.writeScriptBin "sbt" "";
|
|
};
|
|
|
|
nmt.script = ''
|
|
assertFileExists "home-files/${credentialsSbtPath}"
|
|
assertFileContent "home-files/${credentialsSbtPath}" "${expectedCredentialsSbt}"
|
|
'';
|
|
};
|
|
}
|