-
Notifications
You must be signed in to change notification settings - Fork 241
Description
op CLI version
N/A
Goal or desired behavior
The shell-plugins.nix file should be hardcoded with the output from the CLI command that is currently used dynamically: op plugin list | cut -d ' ' -f1 | tail -n +2 instead of having that command being run dynamically at evaluation time, e.g.
supported_plugins = [
"akamai"
"argocd"
"aws"
"cdk"
"axiom"
"binance-cli"
"cachix"
"cargo"
"circleci"
"civo"
"wrangler"
"crowdin"
"databricks"
"dog"
"doctl"
"fastly"
"flyctl"
"fly"
"fossa"
"tea"
"gh"
"glab"
"vault"
"heroku"
"hcloud"
"brew"
"huggingface-cli"
"influx"
"kaggle"
"lacework"
"forge"
"vapor"
"linode-cli"
"localstack"
"atlas"
"mysql"
"ngrok"
"ohdear"
"okta"
"openai"
"oaieval"
"oaievalset"
"pd"
"psql"
"pg_dump"
"pg_restore"
"pgcli"
"pulumi"
"rdme"
"sentry-cli"
"snowsql"
"snyk"
"src"
"stripe"
"todoist"
"td"
"tugboat"
"twilio"
"upstash"
"vercel"
"vsql"
"vultr-cli"
"ysqlsh"
"zapier"
"zcli"
];
This should be kept manually up-to-date as needed, which is more in-line with Nix standards. If the concern is that it won't be kept up-to-date, you should consider adding checks to test for this at the repository level, but this should not be done dynamically in the code as it is currently as it breaks functionality for some users and makes this library essentially unusable in some scenarios via Nix.
Current behavior
When running nix flake check on a flake with support for multiple architectures that references this 1Password/shell-plugins repo (e.g. running on aarch64-darwin with a definition for NixOS x86_64-linux), the shell-plugins.nix fails to evaluate due to a block of code I link further down that runs into issues trying to evaluate an architecture it is incapable of evaluating, e.g.
error: a 'x86_64-linux' with features {} is required to build '/nix/store/fwy70jdzwf2svhxmgijv7gbf6bwzxi6n-op-plugin-list.drv', but I am a 'aarch64-darwin' with features {apple-virt, benchmark, big-parallel, nixos-test}This occurs in this block of code because we are trying to dynamically generate a file as output from a CLI command that we read at evaluation time (even if you run nix flake check --no-build, it STILL fails, which is a big no-no).
Relevant log output
This is a longer but still incomplete snipped of the most relevant part of the error log from `nix flake check` in the flake referencing this library:
… while calling anonymous lambda
at /nix/store/lr118m1jnkg55k96w05b7pdwlsqd5h33-source/nix/shell-plugins.nix:40:16:
39| apply = package_list:
40| map (package:
| ^
41| if (elem (getExeName package) supported_plugins) then
… while evaluating a branch condition
at /nix/store/lr118m1jnkg55k96w05b7pdwlsqd5h33-source/nix/shell-plugins.nix:41:13:
40| map (package:
41| if (elem (getExeName package) supported_plugins) then
| ^
42| package
… while calling the 'elem' builtin
at /nix/store/lr118m1jnkg55k96w05b7pdwlsqd5h33-source/nix/shell-plugins.nix:41:17:
40| map (package:
41| if (elem (getExeName package) supported_plugins) then
| ^
42| package
… from call site
at /nix/store/lr118m1jnkg55k96w05b7pdwlsqd5h33-source/nix/shell-plugins.nix:6:23:
5|
6| supported_plugins = splitString "\n" (lib.readFile "${
| ^
7| # get the list of supported plugin executable names
… while calling 'splitString'
at /nix/store/0if5dcj3vd4887n2rfj3ja5jx0vfb282-source/lib/strings.nix:1587:10:
1586| splitString =
1587| sep: s:
| ^
1588| let
… while calling the 'map' builtin
at /nix/store/0if5dcj3vd4887n2rfj3ja5jx0vfb282-source/lib/strings.nix:1593:5:
1592| in
1593| map (addContextFrom s) splits;
| ^
1594|
… while calling the 'filter' builtin
at /nix/store/0if5dcj3vd4887n2rfj3ja5jx0vfb282-source/lib/strings.nix:1589:16:
1588| let
1589| splits = builtins.filter builtins.isString (
| ^
1590| builtins.split (escapeRegex (toString sep)) (toString s)
… while calling the 'split' builtin
at /nix/store/0if5dcj3vd4887n2rfj3ja5jx0vfb282-source/lib/strings.nix:1590:9:
1589| splits = builtins.filter builtins.isString (
1590| builtins.split (escapeRegex (toString sep)) (toString s)
| ^
1591| );
… while evaluating the second argument passed to builtins.split
… while calling the 'toString' builtin
at /nix/store/0if5dcj3vd4887n2rfj3ja5jx0vfb282-source/lib/strings.nix:1590:54:
1589| splits = builtins.filter builtins.isString (
1590| builtins.split (escapeRegex (toString sep)) (toString s)
| ^
1591| );
… while calling the 'readFile' builtin
at /nix/store/lr118m1jnkg55k96w05b7pdwlsqd5h33-source/nix/shell-plugins.nix:6:41:
5|
6| supported_plugins = splitString "\n" (lib.readFile "${
| ^
7| # get the list of supported plugin executable names
… while realising the context of path '/nix/store/85jkbkmans0wp69z26564ynphywg45lr-op-plugin-list/plugins.txt'
error: a 'x86_64-linux' with features {} is required to build '/nix/store/fwy70jdzwf2svhxmgijv7gbf6bwzxi6n-op-plugin-list.drv', but I am a 'aarch64-darwin' with features {apple-virt, benchmark, big-parallel, nixos-test}