nix: avoid IFD#594
Open
auscyber wants to merge 1 commit into1Password:mainfrom
Open
Conversation
There was a problem hiding this comment.
Pull request overview
This PR aims to remove IFD (import-from-derivation) from the Nix module by moving plugin support validation from evaluation-time file reads into a separate derivation, so NixOS/Home Manager builds can proceed in parallel instead of being blocked on building/running op early.
Changes:
- Replaces the eval-time supported-plugin list generation with a
runCommand-based support check derivation that runsop plugin list. - Introduces
opPkgto consistently choose theoppackage used by the check. - Attempts to hook the support check into Home Manager / NixOS via new
home.checks/system.checksassignments.
Comments suppressed due to low confidence (2)
nix/shell-plugins.nix:141
home.checksis not a standard Home Manager option, so this will likely fail module evaluation with “The optionhome.checksdoes not exist”. Consider wiring the derivation into an existing mechanism (e.g., assertions/warnings, activation, or another supported dependency hook) so the check is actually built/run.
(optionalAttrs is-home-manager {
home.checks = [ plugin-support-check ];
programs = {
# for the Bash and Zsh home-manager modules,
# the initExtra/initContent option is equivalent to Fish's interactiveShellInit
bash.initExtra = initExtraPosix;
nix/shell-plugins.nix:155
system.checksis not a standard NixOS module option, so this will likely fail module evaluation with “The optionsystem.checksdoes not exist”. Consider adding the derivation via a supported NixOS hook (e.g.,system.extraDependenciesif available, or another established mechanism) to ensure it builds without breaking evaluation.
(optionalAttrs (!is-home-manager) {
system.checks = [ plugin-support-check ];
programs = {
bash.interactiveShellInit =
strings.concatStringsSep "\n" posixFunctions;
zsh.interactiveShellInit = strings.concatStringsSep "\n" posixFunctions;
};
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+25
to
+33
| pkgs.runCommand "op-shell-plugins-support-check" | ||
| { | ||
| nativeBuildInputs = [ pkgs.coreutils pkgs.gnugrep pkgs.gawk pkgs.gnused ]; | ||
| } | ||
| '' | ||
| set -euo pipefail | ||
|
|
||
| export XDG_CONFIG_HOME="$TMPDIR/xdg-config" | ||
| mkdir -p "$XDG_CONFIG_HOME" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Removed IFD (import from derivation) from the nix module
the current implementation requires building the op executable before anything else can happen which results in significant slowdown of system builds as everything is halted until 1password builds. Removing IFD allows the nix module to be built without building the op executable first, which should speed up system builds significantly. The check still happens, but as a derivation instead of a plugin, which means it can be built in parallel with the rest of the system instead of halting everything until it's done.
Type of change
Related Issue(s)
How To Test
Attempt to use the nix module on home-manager or nixos
Changelog