I am working on updating a module in nixpkgs and to test locally, I typically use the following configuration:
# flake.nix
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/...";
nixpkgs-dq = "github:dq/nixpkgs/...";
...
};
outputs =
inputs@{
self,
...
nixpkgs,
nixpkgs-dq,
...
...
}:
let
specialArgs = {
inherit inputs;
pkgs-dq = import nixpkgs-dq {
system = "aarch64-linux";
config.allowUnfree = true;
};
};
extraSpecialArgs = { inherit inputs; };
in
rec {
...
nixosConfigurations."dq" = nixpkgs.lib.nixosSystem {
inherit specialArgs;
system = "aarch64-linux";
modules = [
...
./machines/dq/configuration.nix
...
];
};
...
}
# ./machines/dq/configuration.nix
{
...
pkgs,
pkgs-dq,
...
}:
{
disabledModules = [
"services/audio/example.nix"
];
imports = [
/path/to/local/nixpkgs/nixos/modules/services/audio/example.nix
];
# will now use service module and package in local nixpkgs on rebuild
services.audio.example.enable = true;
services.audio.example.pkg = pkgs-dq.audiopkg;
...
}
The only small drawback here is having to use --impure on system rebuild.
I tried different approaches:
imports = [
pkgs-dq.services.audio.example
];
imports = [
<pkgs-dq/services/audio/example>
];
imports = [
"pkgs-dq/services/audio/example"
];