Closed yonkeltron closed 5 months ago
Using nix shell
by itself doesn't run shell hooks. You can either make a dev shell in a flake and use nix develop
:
{
description = "A very basic flake";
outputs = { self, nixpkgs}:
let
allSystems = nixpkgs.lib.systems.flakeExposed;
forAllSystems = nixpkgs.lib.genAttrs allSystems;
define = f: forAllSystems (system:
let
pkgs = import nixpkgs {
inherit system;
config.allowUnfree = true;
};
in
f pkgs
);
in
{
devShells = define (pkgs: {
default = pkgs.mkShell {
buildInputs = [
pkgs.pkg-config
pkgs.libsodium
];
};
}
);
};
}
or you can use nix-shell
:
nix-shell -p libsodium pkg-config
Sorry, so does this mean it shouldn't work in my normal, day-to-day shell either? Because that's what i'm struggling with a bit more.
Can confirm it works with nix-shell -p libsodium pkg-config
but not in my regular shell.
Love, +Jonathan
Yes, installing these packages systemwide will also not run the necessary setup hooks. The "right" way to do per-project dependencies is with a dev shell
The "right" way to do per-project dependencies is with a dev shell
Ok, this mostly makes sense. What about if I want to compile and install a binary for my user? Like even some tool with cargo?
NINJA EDIT: Also asking because I have tried to install things with nix-darwin which have actually needed compilation and I didn't realize it until the install failed.
What about if I want to compile and install a binary for my user?
Then you would write a Nix derivation for that package, which would include the dependencies, but you still wouldn't install the dependencies systemwide
What about if I want to compile and install a binary for my user?
Then you would write a Nix derivation for that package, which would include the dependencies, but you still wouldn't install the dependencies systemwide
Ok because I have had issues with unavailable libraries trying to install the bupstash package, which is what first brought this issue to my attention. Did I do something wrong?
bupstash works fine for me on aarch64-darwin, but doesn't work on x86_64-darwin. Not sure what's wrong with it there, but if you're on x86_64-darwin, then you didn't do anything wrong
Since I am on aarch, it seems something is actually wrong. How can I troubleshoot or provide more info? Seems like this could be a bug after all.
What exactly are you doing? I'm running
nix shell nixpkgs#bupstash
and it's working for me.
Can you let me know what exactly you're running, and provide the output of that command?
That works, but not installing it as a package for my user more generally.
# ...snip...
packages = with pkgs; [
# ...snip...
bupstash
clang
cmake
darwin.apple_sdk.frameworks.CoreServices
darwin.apple_sdk.frameworks.Foundation
darwin.Libnotify
# ...snip...
libsodium
libsodium.dev
llvmPackages_latest.lld
llvmPackages_latest.llvm
# ...snip...
This used to produce an error, but doesn't for whatever reason. It must no longer be trying to compile the package. Ok, then. I believe we are good.
Hello,
When trying to compile various libraries in a fresh nix-darwin install (using the flake approach), I get all manner of missing library errors. This seems to be related to an underlying issue with
pkg-config
as illustrated here, which also shows that thePKG_CONFIG_PATH
environment variable is not set:I am on macOS Sonoma 14.4.1 with the following environment:
Please let me know if I can provide any additional information or help with testing.
Love, +Jonathan