Skip to content

Instantly share code, notes, and snippets.

@r17x
Created November 26, 2024 07:20
Show Gist options
  • Save r17x/1f6666855edf93726fb5c19b7b46db22 to your computer and use it in GitHub Desktop.
Save r17x/1f6666855edf93726fb5c19b7b46db22 to your computer and use it in GitHub Desktop.
nix multi-branch set of packages
{
inputs = {
## -- nixpkgs
nixpkgs-master.url = "github:NixOS/nixpkgs/master";
nixpkgs-stable.url = "github:NixOS/nixpkgs/release-24.05";
nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
nixpkgs-specific.url = "github:NixOS/nixpkgs?rev=<HASH-COMMIT>";
nixpkgs.follows = "nixpkgs-unstable";
home-manager.url = "github:nix-community/home-manager";
};
outputs =
inputs:
let
system = "aarch64-linux";
pkgs = import inputs.nixpkgs { inherit system; };
pkgs-stable = import inputs.nixpkgs-stable { inherit system; };
pkgs-master = import inputs.nixpkgs-master { inherit system; };
# pkgs-unstable = import inputs.nixpkgs-unstable { inherit system; }; # no pkgs-unstable because `inputs.nixpkgs` is same as `inputs.nixpkgs-unstable`.
in
{
homeConfigurations = {
rin = inputs.home-manager.lib.homeManagerConfiguration {
inherit pkgs; # same thing with `pkgs = pkgs;`
extraSpecialArgs = {
inherit pkgs-stable pkgs-master;
};
modules = [
# pass attrset into `modules`
{
home.stateVersion = "22.05"; # the release version of home-manager that want to use
home.username = "rin";
home.homeDirectory = "/Users/rin";
}
# pass function into `modules`
(
{ pkgs, pkgs-stable, pkgs-master,... }:
{
home.packages = [
pkgs.du
pkgs-stable.git
];
programs.starship.package = pkgs-master.starship;
}
)
];
};
};
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment