Add cargo credentials provider via pass

This commit is contained in:
Simon Bruder 2024-08-08 23:37:40 +02:00
parent 391234776a
commit 0345000e05
Signed by: simon
GPG key ID: 347FF8699CDA0776
2 changed files with 17 additions and 0 deletions

View file

@ -24,6 +24,7 @@
./neovim
./pass.nix
./programs.nix
./rust.nix
./scripts
./sway
./tmate.nix

View file

@ -0,0 +1,16 @@
# SPDX-FileCopyrightText: 2024 Simon Bruder <simon@sbruder.de>
#
# SPDX-License-Identifier: AGPL-3.0-or-later
{ lib, pkgs, ... }:
{
home.file.".cargo/config.toml".source = (pkgs.formats.toml { }).generate "cargo-config.toml" {
registry = {
global-credential-providers = lib.singleton "cargo:token-from-stdout ${pkgs.writeShellScript "" ''
set -eu
pass cargo/registry-token/"$(base64 -w0 <<< "''${CARGO_REGISTRY_INDEX_URL}")"
''}";
};
};
}