Skip to content

Instantly share code, notes, and snippets.

@pigam
Created February 13, 2023 17:15
Show Gist options
  • Select an option

  • Save pigam/095b15016cb8a30b4b28e317375e7d4b to your computer and use it in GitHub Desktop.

Select an option

Save pigam/095b15016cb8a30b4b28e317375e7d4b to your computer and use it in GitHub Desktop.
Use a local flake as input in devenv.yaml
{ pkgs, inputs, ... }:
let
extra = inputs.local.devShell."${pkgs.system}".buildInputs;
in
{
packages = [ pkgs.git ] ++ extra;
}
inputs:
nixpkgs:
url: github:NixOS/nixpkgs/nixpkgs-unstable
local:
url: /home/gamba/Documents/code/hello
# does not work
# url: .
{
description = "A very basic flake";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
hello = pkgs.hello;
in {
packages.default = hello;
packages.hello = hello;
devShell = pkgs.mkShell {
buildInputs = [hello];
};
});
}
@attilaolah
Copy link
Copy Markdown

Note that while url: . does not work since it leads to an infinite recursion, something like url: path:./flake works, then put your flake.nix and flake.lock under ./flake/ and you're good.

Downside is that the flake has to be in a subdirectory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment