Skip to content

Instantly share code, notes, and snippets.

@natecox
Last active November 6, 2023 21:17
Show Gist options
  • Save natecox/d695aaf63908feaca99c9e9641268896 to your computer and use it in GitHub Desktop.
Save natecox/d695aaf63908feaca99c9e9641268896 to your computer and use it in GitHub Desktop.
Devenv Up Troubleshooting
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.05";
systems.url = "github:nix-systems/default";
devenv.url = "github:cachix/devenv";
};
nixConfig = {
extra-trusted-public-keys = "devenv.cachix.org-1:w1cLUi8dv3hnoSPGAuibQv+f9TZLr6cv/Hm9XgU50cw=";
extra-substituters = "https://devenv.cachix.org";
};
outputs = { self, nixpkgs, devenv, systems, ... } @ inputs:
let
forEachSystem = nixpkgs.lib.genAttrs (import systems);
in
{
devShells = forEachSystem
(system:
let
pkgs = nixpkgs.legacyPackages.${system};
in
{
default = devenv.lib.mkShell {
inherit inputs pkgs;
modules = [
{
# https://devenv.sh/reference/options/
packages = [ pkgs.hello ];
enterShell = ''
hello
'';
}
];
};
});
};
}
❯ mkdir direnv_test
~/src/natecox
❯ cd direnv_test/
src/natecox/direnv_test
❯ nix flake init --template github:cachix/devenv
wrote: /Users/ncox/src/natecox/direnv_test/.envrc
wrote: /Users/ncox/src/natecox/direnv_test/flake.nix
.devenv should be added to .gitignore
| echo .devenv >> .gitignore
direnv: error /Users/ncox/src/natecox/direnv_test/.envrc is blocked. Run `direnv allow` to approve its content
src/natecox/direnv_test
❯ nix develop --impure
warning: creating lock file '/Users/ncox/src/natecox/direnv_test/flake.lock'
Hello, world!
(devenv) bash-5.2$ devenv up
error: flake 'path:/Users/ncox/src/natecox/direnv_test' does not provide attribute 'packages.aarch64-darwin.devenv-up', 'legacyPackages.aarch64-darwin.devenv-up' or 'devenv-up'
(devenv) bash-5.2$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment