mirror of
https://github.com/nix-community/home-manager
synced 2024-11-23 19:49:45 +01:00
add logic, missing options
This commit is contained in:
parent
e3ad5108f5
commit
90388be582
1 changed files with 20 additions and 5 deletions
|
@ -3,7 +3,14 @@
|
||||||
let
|
let
|
||||||
cfg = config.programs.awscli;
|
cfg = config.programs.awscli;
|
||||||
iniFormat = pkgs.formats.ini { };
|
iniFormat = pkgs.formats.ini { };
|
||||||
|
settingsPath =
|
||||||
|
if config.programs.awscli.settings.path != ""
|
||||||
|
then config.programs.awscli.settings.path
|
||||||
|
else "${config.home.homeDirectory}/.aws/config";
|
||||||
|
credentialsPath =
|
||||||
|
if config.programs.awscli.credentials.path != ""
|
||||||
|
then config.programs.awscli.credentials.path
|
||||||
|
else "${config.home.homeDirectory}/.aws/credentials";
|
||||||
in {
|
in {
|
||||||
meta.maintainers = [ lib.maintainers.anthonyroussel ];
|
meta.maintainers = [ lib.maintainers.anthonyroussel ];
|
||||||
|
|
||||||
|
@ -57,13 +64,21 @@ in {
|
||||||
config = lib.mkIf cfg.enable {
|
config = lib.mkIf cfg.enable {
|
||||||
home.packages = [ cfg.package ];
|
home.packages = [ cfg.package ];
|
||||||
|
|
||||||
home.file."${config.home.homeDirectory}/.aws/config" =
|
home.sessionVariables =
|
||||||
|
(lib.mkIf (cfg.settings.path != "") {
|
||||||
|
AWS_CONFIG_FILE = cfg.settings.path;
|
||||||
|
}) //
|
||||||
|
(lib.mkIf (cfg.credentials.path != "") {
|
||||||
|
AWS_SHARED_CREDENTIALS_FILE = cfg.credentials.path;
|
||||||
|
});
|
||||||
|
|
||||||
|
home.file.(settingsPath) =
|
||||||
lib.mkIf (cfg.settings != { }) {
|
lib.mkIf (cfg.settings != { }) {
|
||||||
source =
|
source = iniFormat.generate "aws-config-${config.home.username}"
|
||||||
iniFormat.generate "aws-config-${config.home.username}" cfg.settings;
|
cfg.settings;
|
||||||
};
|
};
|
||||||
|
|
||||||
home.file."${config.home.homeDirectory}/.aws/credentials" =
|
home.file.(credentialsPath) =
|
||||||
lib.mkIf (cfg.credentials != { }) {
|
lib.mkIf (cfg.credentials != { }) {
|
||||||
source = iniFormat.generate "aws-credentials-${config.home.username}"
|
source = iniFormat.generate "aws-credentials-${config.home.username}"
|
||||||
cfg.credentials;
|
cfg.credentials;
|
||||||
|
|
Loading…
Reference in a new issue