aboutsummaryrefslogtreecommitdiffstats
path: root/modules/programs
diff options
context:
space:
mode:
Diffstat (limited to 'modules/programs')
-rw-r--r--modules/programs/git/default.nix16
-rw-r--r--modules/programs/pass/default.nix48
2 files changed, 34 insertions, 30 deletions
diff --git a/modules/programs/git/default.nix b/modules/programs/git/default.nix
index bd91511..3d367df 100644
--- a/modules/programs/git/default.nix
+++ b/modules/programs/git/default.nix
@@ -12,14 +12,17 @@
type = lib.types.str;
description = "Git username.";
};
+
email = lib.mkOption {
type = lib.types.str;
description = "Git email.";
};
+
+ useSSH = lib.mkEnableOption "Use SSH instead of HTTPS for common git platforms.";
};
config = lib.mkIf config.programs.git.enable {
- home.packages = lib.mkIfconfig config.programs.pass.enable [ pkgs.pass-git-helper ];
+ home.packages = lib.mkIf config.programs.pass.enable [ pkgs.pass-git-helper ];
programs.git = {
settings =
@@ -32,11 +35,12 @@
core.askPass = "";
}
(
- lib.optionalAttrs config.programs.pass.enable {
- credential."https://github.com" = {
- username = config.programs.pass.github.username;
- helper = lib.getExe pkgs.pass-git-helper;
- };
+ lib.optionalAttrs config.programs.git.useSSH {
+ url."git@github.com:".insteadOf = "https://github.com/";
+ url."git@gitlab.com:".insteadOf = "https://gitlab.com/";
+ url."git@bitbucket.org:".insteadOf = "https://bitbucket.org/";
+ url."git@codeberg.org:".insteadOf = "https://codeberg.org/";
+ url."git@git.sr.ht:".insteadOf = "https://git.sr.ht/";
}
);
};
diff --git a/modules/programs/pass/default.nix b/modules/programs/pass/default.nix
index d5067b9..0455d31 100644
--- a/modules/programs/pass/default.nix
+++ b/modules/programs/pass/default.nix
@@ -19,35 +19,35 @@
};
};
- config = lib.mkIf config.program.pass.enable {
+ config = lib.mkIf config.programs.pass.enable {
programs.password-store = {
enable = true;
- package = config.program.pass.package;
+ package = config.programs.pass.package;
settings = {
- PASSWORD_STORE_DIR = config.program.pass.storeDir;
+ PASSWORD_STORE_DIR = config.programs.pass.storeDir;
};
};
- home.file.".config/pass-git-helper/git-pass-mapping.ini".text = ''
- [github.com]
- target = github/token
- username = ${config.program.pass.github.username}
- username_extractor = static
-
- [github.com/*]
- target = github/token
- username = ${config.program.pass.github.username}
- username_extractor = static
-
- [*.github.com]
- target = github/token
- username = ${config.program.pass.github.username}
- username_extractor = static
-
- [*.github.com/*]
- target = github/token
- username = ${config.program.pass.github.username}
- username_extractor = static
- '';
+ # home.file.".config/pass-git-helper/git-pass-mapping.ini".text = ''
+ # [github.com]
+ # target = github/token
+ # username = ${config.programs.pass.github.username}
+ # username_extractor = static
+ #
+ # [github.com/*]
+ # target = github/token
+ # username = ${config.programs.pass.github.username}
+ # username_extractor = static
+ #
+ # [*.github.com]
+ # target = github/token
+ # username = ${config.programs.pass.github.username}
+ # username_extractor = static
+ #
+ # [*.github.com/*]
+ # target = github/token
+ # username = ${config.programs.pass.github.username}
+ # username_extractor = static
+ # '';
};
}