I made a custom package then I spent a few hours trying to add a custom package in a flake in my main nixOS flake.
As per Xe’s guide, I added an overlay in the custom package’s flake:
{
outputs = { self, nixpkgs }: {
overlay = final: prev: { muttdown = prev.pkgs.callPackage ./derivation.nix { }; };
packages.x86_64-linux.muttdown = nixpkgs.legacyPackages.x86_64-linux.callPackage ./derivation.nix {};
packages.x86_64-linux.default = self.packages.x86_64-linux.muttdown;
};
}
Then added the overlay
{
description = "Jevin's Humi Home Manager configuration";
inputs = {
# Specify the source of Home Manager and Nixpkgs
home-manager.url = "github:nix-community/home-manager/release-22.11";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-22.11";
nixos-hardware.url = "github:NixOS/nixos-hardware";
nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
muttdown.url = "path:./custom_packages/muttdown/";
stylix.url = "github:danth/stylix";
};
outputs = { home-manager, stylix, nixpkgs, nixpkgs-unstable, nixos-hardware, muttdown, ... }@inputs:
# Modeling it after: https://rycee.gitlab.io/home-manager/index.html#sec-flakes-nixos-module
let
system = "x86_64-linux";
overlay-unstable = final: prev: {
unstable = import nixpkgs-unstable {
inherit system;
config.allowUnfree = true;
};
};
in {
nixosConfigurations = {
# <... Extra hosts removed for clarity... >
framework = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = { inherit inputs; }; # Pass flake inputs to our config
overlays = [ overlay-unstable muttdown.overlay];
modules = [
./nixos/framework/configuration.nix
./nixos/framework/hardware-configuration.nix
./printers.nix
stylix.nixosModules.stylix ./theme-personal.nix
nixos-hardware.nixosModules.framework-12th-gen-intel
home-manager.nixosModules.home-manager
{
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
extraSpecialArgs = { inherit stylix; };
users = {
jevin = import ./jevin-linux.nix;
jevinhumi = import ./work-linux.nix;
};
};
}
];
};
};
};
}
When rebuilding, I get the error:
warning: Git tree '/home/jevin/.config/nixpkgs' is dirty
error: anonymous function at /nix/store/0ww6l2a68jv8pq99scbmjqinwrh941x0-source/nixos/lib/eval-config.nix:11:1 called with unexpected argument 'overlays'
at /nix/store/0ww6l2a68jv8pq99scbmjqinwrh941x0-source/flake.nix:22:11:
21| nixosSystem = args:
22| import ./nixos/lib/eval-config.nix (
| ^
23| args // {
I’m stuck.
Full code tree: GitHub - jevy/home-manager-nix-config at muttdown