spread: init at 0-unstable-2023-03-01

+79
+13
pkgs/by-name/sp/spread/local-script-path.patch
···
··· 1 + diff --git a/spread/client.go b/spread/client.go 2 + index c72d48a..e927567 100644 3 + --- a/spread/client.go 4 + +++ b/spread/client.go 5 + @@ -791,7 +791,7 @@ func (s *localScript) run() (stdout, stderr []byte, err error) { 6 + buf.WriteString("NOMATCH() { { set +xu; } 2> /dev/null; local stdin=$(cat); if echo $stdin | grep -q -E \"$@\"; then echo \"NOMATCH pattern='$@' found in:\n$stdin\">&2; return 1; fi }\n") 7 + buf.WriteString("export DEBIAN_FRONTEND=noninteractive\n") 8 + buf.WriteString("export DEBIAN_PRIORITY=critical\n") 9 + - buf.WriteString("export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin\n") 10 + + buf.WriteString(fmt.Sprintf("export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin:%s\n", os.Getenv("PATH"))) 11 + 12 + for _, k := range s.env.Keys() { 13 + v := s.env.Get(k)
+66
pkgs/by-name/sp/spread/package.nix
···
··· 1 + { 2 + lib, 3 + buildGoModule, 4 + fetchFromGitHub, 5 + nix-update-script, 6 + bash, 7 + coreutils, 8 + gnutar, 9 + gzip, 10 + makeWrapper, 11 + }: 12 + 13 + buildGoModule { 14 + pname = "spread"; 15 + version = "0-unstable-2023-03-01"; 16 + 17 + src = fetchFromGitHub { 18 + owner = "snapcore"; 19 + repo = "spread"; 20 + rev = "ded9133cdbceaf01f8a1c9decf6ff9ea56e194d6"; 21 + hash = "sha256-uHBzVABfRCyBAGP9f+2GS49Qc8R9d1HaRr6bYPeVSU4="; 22 + }; 23 + 24 + vendorHash = "sha256-SULAfCLtNSnuUXvA33I48hnhU0Ixq79HhADPIKYkWNU="; 25 + 26 + subPackages = [ "cmd/spread" ]; 27 + 28 + nativeBuildInputs = [ makeWrapper ]; 29 + 30 + patches = [ 31 + # The upstream project statically assigns a PATH when running scripts in the 32 + # local machine context. This patch keeps that static PATH assignment, but also 33 + # appends the PATH from the environment context in which spread was run, so 34 + # that nix-installed binaries are also available. 35 + ./local-script-path.patch 36 + ]; 37 + 38 + postPatch = '' 39 + # Replace direct calls to /bin/bash 40 + substituteInPlace spread/lxd.go --replace-fail '"/bin/bash", ' '"/usr/bin/env", "bash", ' 41 + substituteInPlace spread/client.go --replace-fail '"/bin/bash", ' '"/usr/bin/env", "bash", ' 42 + substituteInPlace spread/project.go --replace-fail '"/bin/bash", ' '"/usr/bin/env", "bash", ' 43 + ''; 44 + 45 + postInstall = '' 46 + wrapProgram $out/bin/spread --prefix PATH : ${ 47 + lib.makeBinPath [ 48 + bash 49 + coreutils 50 + gnutar 51 + gzip 52 + ] 53 + } 54 + ''; 55 + 56 + passthru.updateScript = nix-update-script { }; 57 + 58 + meta = { 59 + mainProgram = "spread"; 60 + license = lib.licenses.gpl3Only; 61 + description = "Convenient full-system test (task) distribution"; 62 + homepage = "https://github.com/snapcore/spread"; 63 + maintainers = with lib.maintainers; [ jnsgruk ]; 64 + platforms = lib.platforms.linux; 65 + }; 66 + }