I looked and there doesn't seem to be a straightforward way to override flake inputs from the CLI. But I was wondering what method(s) you have employed to do so? I'm looking for opinions on how to do this with minimal changes.
At the moment, I have this:
inputs = {
nixpkgs-1stable.url = "github:NixOS/nixpkgs/nixos-24.05";
home-manager-1stable.url = "github:nix-community/home-manager/release-24.05";
home-manager-1stable.inputs.nixpkgs.follows = "nixpkgs-1stable";
nixpkgs-1stable-small.url = "github:NixOS/nixpkgs/nixos-24.05-small";
home-manager-1stable-small.url = "github:nix-community/home-manager/release-24.05";
home-manager-1stable-small.inputs.nixpkgs.follows = "nixpkgs-1stable-small";
nixpkgs-0unstable.url = "github:NixOS/nixpkgs/nixos-unstable";
home-manager-0unstable.url = "github:nix-community/home-manager/master";
home-manager-0unstable.inputs.nixpkgs.follows = "nixpkgs-0unstable";
nixpkgs-0unstable-small.url = "github:NixOS/nixpkgs/nixos-unstable-small";
home-manager-0unstable-small.url = "github:nix-community/home-manager/master";
home-manager-0unstable-small.inputs.nixpkgs.follows = "nixpkgs-0unstable-small";
};
outputs = { self,
nixpkgs-1stable, home-manager-1stable,
nixpkgs-1stable-small, home-manager-1stable-small,
nixpkgs-0unstable, home-manager-0unstable,
nixpkgs-0unstable-small, home-manager-0unstable-small,
... }:
let
nixpkgsRelease = "24.05";
nixpkgs = nixpkgs-1stable;
home-manager = home-manager-1stable;
#nixpkgs = nixpkgs-1stable-small;
#home-manager = home-manager-1stable-small;
#nixpkgs = nixpkgs-0unstable;
#home-manager = home-manager-0unstable;
#nixpkgs = nixpkgs-0unstable-small;
#home-manager = home-manager-0unstable-small;
# --- [ snip ] ---
I don't see a "clean" way (tbh, I don't see _any way_ lol) to override nixpkgs
to be, say, nixpkgs-0unstable-small
from the CLI without a tech-debt of changes.
Had inputs
not been "static", I could have provided nixos-unstable-small
for nixpkgs
and master
for home-manager
's channels respectively. But alas, I'm stuck here :)
("Static" as in a let..in
block in inputs
such that I could use github:NixOS/nixpkgs/${nixpkgsChannel}
.)
--override-input
?
Oh wow, that worked. I should read the manual instead of user comments :sweat_smile:
Thank you @Srid
@Pratham Patel By the way, is what you are trying to do here similar to this request?
Kind of. I want to use a different channel of nixpkgs/home-manager to test if the the future (nixos-unstable/master) branches introduce a breaking change or not. This runs in a local CI server I have at my home. :)
Last updated: Nov 15 2024 at 12:33 UTC