Open MangoIV opened 12 months ago
alright I looked at the flake template, makes sense! I think I would put the installationScript attribute as
source ${config.agenix-shell/bin/install-agenix-shell}
such that you can just concat it with the rest of your shellHook
For some reason that breaks my entire devShell 😞
Hey sorry but I missed this issue, have you figured it out in the end?
Yeah probably including the source
part is in the installationScript
is not a bad idea. Probably I will create another option (internal
) which contains just the installationScript
as now and a new installationCommand
with default value is "source ${installationScript}"
, so we leave more customizability if someone for some reason doesn't need to source
it.
Also notice that my initial idea was providing this raw installationScript
for a "vanilla" experience but then add a module that extends devshell's options and use it myself (I tend to use devshell
whenever I can).
Running ${lib.getExe config.agenix-shell.installationScript}
in devenv enterShell still has no effect, and sourcing it breaks other shell variables
@MrFoxPro How does it break them? If you give me a repro that uses devenv I will try to fix it (and we could also add it to templates/checks).
@MrFoxPro How does it break them? If you give me a repro that uses devenv I will try to fix it (and we could also add it to templates/checks).
Okay I will try. What I mean by breaking is all binaries provided by packages = [] are gone (I guess because PATH overriden)
@MrFoxPro In the past few weeks I tidied up a bit the repository (there were things that didn't make sense) and after I tried to replicate your problem but it doesn't seem to appear.
This is the flake I'm using:
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
devenv.url = "github:cachix/devenv";
agenix-shell.url = "github:aciceri/agenix-shell";
};
outputs = inputs: let
system = "x86_64-linux";
pkgs = inputs.nixpkgs.legacyPackages.${system};
lib = pkgs.lib;
installationScript = inputs.agenix-shell.packages.${system}.installationScript.override {
agenixShellConfig.secrets = {
foo.file = ./secrets/foo.age;
};
};
in {
devShell.x86_64-linux = inputs.devenv.lib.mkShell {
inherit inputs pkgs;
modules = [
({ pkgs, config, ... }: {
packages = [ pkgs.hello ];
enterShell = ''
source ${lib.getExe installationScript}
'';
})
];
};
};
}
I also just added this example to templates.
@MrFoxPro In the past few weeks I tidied up a bit the repository (there were things that didn't make sense) and after I tried to replicate your problem but it doesn't seem to appear.
This is the flake I'm using:
{ inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; devenv.url = "github:cachix/devenv"; agenix-shell.url = "github:aciceri/agenix-shell"; }; outputs = inputs: let system = "x86_64-linux"; pkgs = inputs.nixpkgs.legacyPackages.${system}; lib = pkgs.lib; installationScript = inputs.agenix-shell.packages.${system}.installationScript.override { agenixShellConfig.secrets = { foo.file = ./secrets/foo.age; }; }; in { devShell.x86_64-linux = inputs.devenv.lib.mkShell { inherit inputs pkgs; modules = [ ({ pkgs, config, ... }: { packages = [ pkgs.hello ]; enterShell = '' source ${lib.getExe installationScript} ''; }) ]; }; }; }
I also just added this example to templates.
Okay thanks I will try a bit later
for me it says
/nix/store/1pp7al3i0pxwdf30fhhxb2nr9rws2mr8-install-agenix-shell
in theshellHook
which is just some directory; I think ideally it should be inlined, i.e. have the store path be directly a the text and not astorepath/bin/exe