fork/home-manager

git clone https://git.julia.blue/fork/home-manager

Philippe Laflammesbt: cache `passwordCommand` output7fee13eb

master
1.2 KiB41 linesraw
1{ config, lib, pkgs, ... }:
2
3with lib;
4
5let
6  credentials = [
7    {
8      realm = "Sonatype Nexus Repository Manager";
9      host = "example.com";
10      user = "user";
11      passwordCommand = "echo password";
12    }
13    {
14      realm = "Sonatype Nexus Repository Manager X";
15      host = "v2.example.com";
16      user = "user1";
17      passwordCommand = "echo password1";
18    }
19  ];
20  expectedCredentialsSbt = pkgs.writeText "credentials.sbt" ''
21    import scala.sys.process._
22    lazy val credential_0 = "echo password".!!.trim
23    credentials += Credentials("Sonatype Nexus Repository Manager", "example.com", "user", credential_0)
24    lazy val credential_1 = "echo password1".!!.trim
25    credentials += Credentials("Sonatype Nexus Repository Manager X", "v2.example.com", "user1", credential_1)
26  '';
27  credentialsSbtPath = ".sbt/1.0/credentials.sbt";
28in {
29  config = {
30    programs.sbt = {
31      enable = true;
32      credentials = credentials;
33      package = pkgs.writeScriptBin "sbt" "";
34    };
35
36    nmt.script = ''
37      assertFileExists "home-files/${credentialsSbtPath}"
38      assertFileContent "home-files/${credentialsSbtPath}" "${expectedCredentialsSbt}"
39    '';
40  };
41}