Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

extraPkgs with flakes #81

Open
pniedzwiedzinski opened this issue Oct 16, 2024 · 3 comments
Open

extraPkgs with flakes #81

pniedzwiedzinski opened this issue Oct 16, 2024 · 3 comments

Comments

@pniedzwiedzinski
Copy link

Hi,
Is there a way to add extraPkgs while using flakes? I'm trying to overrideAttrs, but that's not working with buildFHSUserEnv:

{
  inputs.nix-environments.url = "github:nix-community/nix-environments";

  outputs = { self, nixpkgs, nix-environments }: let
    # Replace this string with your actual system, e.g. "x86_64-linux"
    system = "x86_64-linux";
  in {
    devShell.${system} = let
        pkgs = import nixpkgs { inherit system; };
      in nix-environments.devShells.${system}.arduino.overrideAttrs (old: {
        targetPkgs = old.targetPkgs ++ [ pkgs.micronucleus ];
      });
  };
}
@teu5us
Copy link

teu5us commented Nov 11, 2024

@pniedzwiedzinski This seems to work:

{
  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";

    nixenvs = {
      url = "github:nix-community/nix-environments";
      inputs.nixpkgs.follows = "nixpkgs";
    };
  };

  outputs =
    { nixpkgs, nixenvs, ... }:
    let
      system = "x86_64-linux";
    in
    {
      devShell.${system} =
        let
          pkgs = import nixpkgs { inherit system; };
          arduino = import (builtins.toPath nixenvs.outPath + "/envs/arduino/shell.nix") {
            inherit pkgs;
            extraPkgs = with pkgs; [ arduino-cli ];
          };
        in
        arduino;
    };
}

@Mic92
Copy link
Member

Mic92 commented Nov 15, 2024

mkShell has this helper called inputsFrom which might be useful. Doesn't work for fhs env very well so.

@teu5us
Copy link

teu5us commented Nov 18, 2024

I actually copied and modified .nix files for arduino-ide and arduino-cli to allow overriding extraPkgs, as I needed python with pyserial, which none of those could use both with mkShell and fhs env.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants