I am not sure how to consume the flake that is created with flake-utils.lib.eachDefaultSystem
with an overlays
property inside it. In the consumer I can specify neovim-custom.overlay.x64_86-darwin
, but that won’t work since I have more than one type of system I run Nix on (a Mac and a couple NixOS systems).
For more specific background, the submodule flake is my neovim config. I’d like to host it in it’s own folder so I can call nix run ...
from other systems. The consumer is my entire config and I am trying to consume the neovim config as an overlay.
The two flakes in question are detailed below.
Flake “submodule” - neovim-custom
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-utils = {
url = "github:numtide/flake-utils";
inputs.nixpkgs.follows = "nixpkgs";
};
neovim-nightly-overlay = {
url = "github:nix-community/neovim-nightly-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = inputs @
{ self
, nixpkgs
, flake-utils
, neovim-nightly-overlay
}:
flake-utils.lib.eachDefaultSystem (system: let
pkgs = import nixpkgs {
inherit system;
};
configDir = ./config;
in rec {
packages.neovim-custom = import ./neovim.nix { inherit pkgs configDir; };
packages.default = packages.neovim-custom;
apps.neovim = flake-utils.lib.mkApp {
drv = packages.neovim-custom;
name = "nvim";
};
defaultApp = apps.neovim;
devShells.default = pkgs.mkShell {
packages = with pkgs; [ rnix-lsp terraform-ls tree-sitter ];
buildInputs = [
packages.neovim-custom
];
};
# I named the overlay `neovim-custom`. I don't know if that's the best route.
overlays = final: prev: rec {
inherit (packages) neovim-custom;
};
}
);
}
Flake “consumer” - this flake consumes the one above
{
description = "Milo's flake";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
darwin = {
url = "github:LnL7/nix-darwin/master";
inputs.nixpkgs.follows = "nixpkgs";
};
flake-utils = {
url = "github:numtide/flake-utils";
inputs.nixpkgs.follows = "nixpkgs";
};
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
neovim-custom = {
url = "path:modules/neovim";
inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-utils.follows = "flake-utils";
};
};
outputs = inputs @
{ self
, nixpkgs
, darwin
, flake-utils
, home-manager
, neovim-custom
}:
let
overlays = final: prev:
{
# Series of overlays that currently work properly.
};
nixpkgsConfig = with inputs; {
overlays = [
neovim-custom.overlay.x86_64-darwin # Problem may here!
overlays
];
};
in rec {
darwinConfigurations = {
worktop = darwin.lib.darwinSystem {
# Configure home manager in here and install `neovim-custom` package (from my submodule flake).
};
};
# Other configurations for other systems.
};
}
Notes
I may be going about this the wrong way. I know what I’d like to accomplish and I was trying to model my flake off of the neovim-nightly overlay, but I don’t know if this is the best route.
I am happy to answer any questions and thanks in advance for any help!