Skip to content

Commit

Permalink
refactor: updated secret path and add codeium api_key
Browse files Browse the repository at this point in the history
  • Loading branch information
r17x committed May 25, 2024
1 parent ee3794a commit 7a98720
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
1 change: 1 addition & 0 deletions home/git.nix
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ in
pull.ff = "only";
diff.tool = "vimdiff";
difftool.prompt = false;
diff.sopsdiffer.textconv = "sops -d --config /dev/null";
merge.tool = "vimdiff";
url = {
"[email protected]:" = {
Expand Down
11 changes: 7 additions & 4 deletions hosts/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,14 @@ let
home-manager.users.${user.username} = {
imports = attrValues self.homeManagerModules ++ [
inputs.sops.homeManagerModules.sops
({ config, ... }: {
home.sessionVariables.OPENAI_API_KEY = "$(cat ${config.sops.secrets.openai_api_key.path})";
({ ... }: {
home.sessionVariables.EDITOR = "nvim";
home.sessionVariables.OPENAI_API_KEY = "$(cat ~/.config/sops-nix/secrets/openai_api_key)";
})
];
home.stateVersion = homeManagerStateVersion;
home.user-info = user;
home.username = user.username;
home.packages = [
pkgs.sops
self.packages.${system}.nvim
Expand All @@ -45,7 +47,8 @@ let
sops.gnupg.home = "~/.gnupg";
sops.gnupg.sshKeyPaths = [ ];
sops.defaultSopsFile = ../secrets/secret.yaml;
sops.secrets.openai_api_key.path = "~/.config/sops-nix/secrets/openai_api_key";
sops.secrets.openai_api_key.path = "%r/openai_api_key";
sops.secrets.codeium.path = "%r/codeium";
# git diff integrations
programs.git.extraConfig.diff.sopsdiffer.textconv = "sops -d";
};
Expand All @@ -54,7 +57,7 @@ let
}
);

mkDarwinConfigurations = configurations: builtins.mapAttrs (name: opt: mkDarwin name opt) configurations;
mkDarwinConfigurations = configurations: builtins.mapAttrs mkDarwin configurations;
in

{
Expand Down
2 changes: 2 additions & 0 deletions nvim.nix/config/lsp.nix
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,9 @@
};

plugins.trouble.enable = true;
# TODO: move plugin configuration when needed secrets
plugins.codeium-nvim.enable = true;
plugins.codeium-nvim.configPath.__raw = "vim.env.HOME .. '/.config/sops-nix/secrets/codeium'";
plugins.wtf.enable = true;
plugins.nvim-autopairs.enable = true;

Expand Down
7 changes: 4 additions & 3 deletions secrets/secret.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
openai_api_key: ENC[AES256_GCM,data:mf/Xi/lkD7hR2f/YYoBId+s7wZIJi4y6uZXCbmOIPa4U6tZ31nDGzTiHGEDqn9huIP0u,iv:SXvlC95KCpdvMsGWA0U7kMA8txG/j9xg2qiSYOl970o=,tag:B2oAWmLq+h5LI7ez9d9yYw==,type:str]
openai_organization_id: ENC[AES256_GCM,data:RQ1UJXbI/sXX5lh6iWQ69cIizoo+wts8HAtneA==,iv:hhNVf9j9UUE6/xlxbnZDKh/9ycWdF5wC29qUx7ECRQI=,tag:WkogefLgOMLu6ZTuYBD8Xw==,type:str]
openai_secret_key: ENC[AES256_GCM,data:8WLju5goMwnAM3kOsn/ZC0bZ3XWgqqCACYi4KAEusXlUYPeiskRXoY9jVl5NVXw/LF6j,iv:cIzRbYada7QJSDtHHY4OetYcRFpz033BLRY5iYeCYBU=,tag:ETjOeeR9AIE5to66pUuvDw==,type:str]
codeium: ENC[AES256_GCM,data:yP0qxzxPQ2PeIWHlGLM9CzG8s1bm/WAeGt73NQJmf+EPqfyctaKaZeVs4w3efDBDby/5,iv:OvZQcChh4YOEI8qXalq43DEC1Wzc26x/MNNGLaE+OeI=,tag:xUbkeE80MYTMsb2t5IuPKw==,type:str]
sops:
kms: []
gcp_kms: []
azure_kv: []
hc_vault: []
age: []
lastmodified: "2024-02-09T12:50:46Z"
mac: ENC[AES256_GCM,data:0urwg7ojRdROMudB65Inrj5ubCC2MaCSgKpBl05OuBbnKkwSHUtPK498/7s6/ZZfkkEgYDQ0GM0WG9ufHxe0Zh0u4tO0JVDOAUjmVB3xF4DJxo7kMp9LpeMl3jyXhGyCTlJYhcVqy9ipnDOWygHr5ewNGm4PGSMumAZztZ5U2Zg=,iv:VA1cvUGCYYuf23DN1FbX8aaL/MPUkBRuhfQB8knzK+M=,tag:n0N8rW7WR6gJLheUF+whGw==,type:str]
lastmodified: "2024-05-25T13:41:08Z"
mac: ENC[AES256_GCM,data:/I5se5klbHx/OMyXmIew6f7uk6D+DITYQkoOsSuAmsvZbtzsKSyzoSgeaxhFGVuS8xQLa9tQFLNqwidHiIUQUF9vNufnIxZaXqnBkFE8awCa/Lsk9Q6as8tBlQMN+YM+RfFqKxfPlWWokOGLJPPGH8PRT72DUO3cRc6/Wh50ljk=,iv:W5VtpY+NPFrL3prFlRKq2wKoQ1GEBdu6DLZZwxRnW24=,tag:h6yNjMAaaW7sm3HNCM+4iA==,type:str]
pgp:
- created_at: "2023-07-15T21:00:45Z"
enc: |
Expand All @@ -31,4 +32,4 @@ sops:
-----END PGP MESSAGE-----
fp: B0B63B776767DFAA669D06715CA1E57AFBF76F90
unencrypted_suffix: _unencrypted
version: 3.7.3
version: 3.8.1

0 comments on commit 7a98720

Please sign in to comment.