Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/pr-check-signed-commits.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: Check signed commits in PR
name: Check signed commits in PR
on: pull_request_target

jobs:
build:
name: Check signed commits in PR
name: Check signed commits in PR
permissions:
contents: read
pull-requests: write
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/update-flake-dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
FILE_TO_COMMIT: flake.lock
COMMIT_BRANCH: automation/update-flake-dependencies
COMMIT_MESSAGE: "chore(nix): Update Flake dependencies"
run: |
run: |-
# fetch remote state
git fetch
# if branch exists on remote already
Expand Down
37 changes: 36 additions & 1 deletion flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 22 additions & 6 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,35 @@
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
systems.url = "github:nix-systems/default";
treefmt-nix.url = "github:numtide/treefmt-nix";
};
outputs = { nixpkgs, systems, ... }:
outputs =
{
nixpkgs,
systems,
treefmt-nix,
...
}:
let
forAllSystems = function:
nixpkgs.lib.genAttrs (import systems) (
system: function nixpkgs.legacyPackages.${system}
);
forAllSystems =
function: nixpkgs.lib.genAttrs (import systems) (system: function nixpkgs.legacyPackages.${system});

treefmtEval = forAllSystems (pkgs: treefmt-nix.lib.evalModule pkgs ./treefmt.nix);
in
{
formatter = forAllSystems (pkgs: treefmtEval.${pkgs.system}.config.build.wrapper);

checks = forAllSystems (pkgs: {
formatting = treefmtEval.${pkgs.system}.config.build.check (pkgs.path or ./.);
});

devShells = forAllSystems (pkgs: {
default = pkgs.mkShell {
name = "Shell with Go toolchain";
packages = with pkgs; [ go gopls ];
packages = with pkgs; [
go
gopls
];
};
});

Expand Down
7 changes: 6 additions & 1 deletion nix/home-manager.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
{ pkgs, lib, config, ... }:
{
pkgs,
lib,
config,
...
}:
import ./shell-plugins.nix {
inherit pkgs;
inherit lib;
Expand Down
7 changes: 6 additions & 1 deletion nix/nixos.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
{ pkgs, lib, config, ... }:
{
pkgs,
lib,
config,
...
}:
import ./shell-plugins.nix {
inherit pkgs;
inherit lib;
Expand Down
64 changes: 32 additions & 32 deletions nix/shell-plugins.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
{ pkgs, lib, config, is-home-manager, ... }:
{
pkgs,
lib,
config,
is-home-manager,
...
}:
with lib;
let
cfg = config.programs._1password-shell-plugins;
Expand Down Expand Up @@ -44,15 +50,13 @@ in
# for which the executable has a supported 1Password Shell Plugin
apply =
package_list:
map
(
package:
if (elem (getExeName package) supported_plugins) then
package
else
abort "${getExeName package} is not a valid 1Password Shell Plugin. A list of supported plugins can be found by running `op plugin list` or at: https://developer.1password.com/docs/cli/shell-plugins/"
)
package_list;
map (
package:
if (elem (getExeName package) supported_plugins) then
package
else
abort "${getExeName package} is not a valid 1Password Shell Plugin. A list of supported plugins can be found by running `op plugin list` or at: https://developer.1password.com/docs/cli/shell-plugins/"
) package_list;
};
};
};
Expand Down Expand Up @@ -80,26 +84,20 @@ in
# end
# ```
# where `{pkg}` is the executable name of the package
posixFunctions = map
(package: ''
${package}() {
op plugin run -- ${package} "$@";
}
'')
pkg-exe-names;
fishFunctions = map
(package: ''
function ${package} --wraps "${package}" --description "1Password Shell Plugin for ${package}"
op plugin run -- ${package} $argv
end
'')
pkg-exe-names;
posixFunctions = map (package: ''
${package}() {
op plugin run -- ${package} "$@";
}
'') pkg-exe-names;
fishFunctions = map (package: ''
function ${package} --wraps "${package}" --description "1Password Shell Plugin for ${package}"
op plugin run -- ${package} $argv
end
'') pkg-exe-names;
packages = lib.optional (cfg.package != null) cfg.package ++ cfg.plugins;
in
mkIf cfg.enable (mkMerge [
{
programs.fish.interactiveShellInit = strings.concatStringsSep "\n" fishFunctions;
}
{ programs.fish.interactiveShellInit = strings.concatStringsSep "\n" fishFunctions; }
(optionalAttrs is-home-manager {
programs = {
# for the Bash and Zsh home-manager modules,
Expand All @@ -109,20 +107,22 @@ in
};
home = {
inherit packages;
sessionVariables = { OP_PLUGINS_SOURCED = "1"; };
sessionVariables = {
OP_PLUGINS_SOURCED = "1";
};
};
})
(optionalAttrs (!is-home-manager) {
programs = {
bash.interactiveShellInit =
strings.concatStringsSep "\n" posixFunctions;
bash.interactiveShellInit = strings.concatStringsSep "\n" posixFunctions;
zsh.interactiveShellInit = strings.concatStringsSep "\n" posixFunctions;
};
environment = {
systemPackages = packages;
variables = { OP_PLUGINS_SOURCED = "1"; };
variables = {
OP_PLUGINS_SOURCED = "1";
};
};
})
]);
}

6 changes: 3 additions & 3 deletions plugins/circleci/test-fixtures/cli.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ rest_endpoint: api/v2
tls_cert: ""
tls_insecure: false
orb_publishing:
default_namespace: ""
default_vcs_provider: ""
default_owner: ""
default_namespace: ""
default_vcs_provider: ""
default_owner: ""
26 changes: 13 additions & 13 deletions plugins/gitea/test-fixtures/config.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
logins:
- name: https://git.example.com
url: https://git.example.com
token: oyyfsny27bgphldmhvffxhhlmqvdkzjrfslrsj9f
default: true
ssh_host: ""
ssh_key: ""
insecure: false
ssh_certificate_principal: ""
ssh_agent: false
ssh_key_agent_pub: ""
version_check: false
user: example
created: 0
- name: https://git.example.com
url: https://git.example.com
token: oyyfsny27bgphldmhvffxhhlmqvdkzjrfslrsj9f
default: true
ssh_host: ""
ssh_key: ""
insecure: false
ssh_certificate_principal: ""
ssh_agent: false
ssh_key_agent_pub: ""
version_check: false
user: example
created: 0
38 changes: 19 additions & 19 deletions plugins/gitea/test-fixtures/import_config.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
logins:
- name: git.example.com
url: https://git.example.com
token: oyyfsny27bgphldmhvffxhhlmqvdkzjrfslrsj9f
default: false
ssh_host: git.example.com
ssh_key: ~/.ssh/id_ed25519
insecure: false
user: example
created: 1479340800000
- name: gitea.com
url: https://gitea.com
token: enjkarzu2ca5ffcnvzaczxncuczeoq9utlpqqrzs
default: false
ssh_host: git.example.com
ssh_key: ~/.ssh/id_ed25519
insecure: true
user: example@example.com
created: 1479340800000
- name: git.example.com
url: https://git.example.com
token: oyyfsny27bgphldmhvffxhhlmqvdkzjrfslrsj9f
default: false
ssh_host: git.example.com
ssh_key: ~/.ssh/id_ed25519
insecure: false
user: example
created: 1479340800000
- name: gitea.com
url: https://gitea.com
token: enjkarzu2ca5ffcnvzaczxncuczeoq9utlpqqrzs
default: false
ssh_host: git.example.com
ssh_key: ~/.ssh/id_ed25519
insecure: true
user: example@example.com
created: 1479340800000
preferences:
editor: false
flag_defaults:
remote: ""
remote: ""
12 changes: 6 additions & 6 deletions plugins/github/test-fixtures/hosts.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
github.com:
user: testUser
oauth_token: ghp_B2xokoZVNaqxLhWzxXY0MoARZyZlgEXAMPLE
git_protocol: https
user: testUser
oauth_token: ghp_B2xokoZVNaqxLhWzxXY0MoARZyZlgEXAMPLE
git_protocol: https

enterprise.github.com:
user: enterpriseUser
oauth_token: ghp_4v7aWhddhdqyIR1RmqiRcUjTgzrNFEXAMPLE
git_protocol: ssh
user: enterpriseUser
oauth_token: ghp_4v7aWhddhdqyIR1RmqiRcUjTgzrNFEXAMPLE
git_protocol: ssh
6 changes: 3 additions & 3 deletions plugins/github/test-fixtures/hosts_gho_token.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
github.com:
user: testUser2
oauth_token: gho_8BQUJmcVkoNo7LqYY0Ng1wndPbwwfEXAMPLE
git_protocol: https
user: testUser2
oauth_token: gho_8BQUJmcVkoNo7LqYY0Ng1wndPbwwfEXAMPLE
git_protocol: https
8 changes: 4 additions & 4 deletions plugins/gitlab/test-fixtures/glab-config-self-hosted.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ git_protocol: ssh
check_update: false
display_hyperlinks: false
hosts:
gitlab.acme.com:
api_protocol: https
api_host: api.gitlab.acme.com
token: glpat-sJy3L26ZNW7A3EXAMPLE
gitlab.acme.com:
api_protocol: https
api_host: api.gitlab.acme.com
token: glpat-sJy3L26ZNW7A3EXAMPLE
8 changes: 4 additions & 4 deletions plugins/gitlab/test-fixtures/glab-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ git_protocol: ssh
check_update: false
display_hyperlinks: false
hosts:
gitlab.com:
api_protocol: https
api_host: gitlab.com
token: glpat-sJy3L26ZNW7A3EXAMPLE
gitlab.com:
api_protocol: https
api_host: gitlab.com
token: glpat-sJy3L26ZNW7A3EXAMPLE
Loading