diff --git a/README.md b/README.md index 9c8537f..40c4a1a 100644 --- a/README.md +++ b/README.md @@ -105,6 +105,16 @@ the latest and greatest nix3 flake-enabled command UX. # What next? +## Multiple nixpkgs channels + +`multi-nixpkgs` shows how to setup multiple nixpkgs channels. For example, using the stable channel you can add the unstable version of neovim like: + +``` +home.packages = with pkgs; [ + unstable.neovim +]; +``` + ## Adding more hosts or users You can organize them by hostname and username on `nixos` and `home-manager` diff --git a/multi-nixpkgs/flake.lock b/multi-nixpkgs/flake.lock index 6b8c59c..220e02c 100644 --- a/multi-nixpkgs/flake.lock +++ b/multi-nixpkgs/flake.lock @@ -37,10 +37,27 @@ "type": "github" } }, + "nixpkgs-unstable": { + "locked": { + "lastModified": 1672953546, + "narHash": "sha256-oz757DnJ1ITvwyTovuwG3l9cX6j9j6/DH9eH+cXFJmc=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "a518c77148585023ff56022f09c4b2c418a51ef5", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, "root": { "inputs": { "home-manager": "home-manager", - "nixpkgs": "nixpkgs" + "nixpkgs": "nixpkgs", + "nixpkgs-unstable": "nixpkgs-unstable" } }, "utils": { diff --git a/multi-nixpkgs/flake.nix b/multi-nixpkgs/flake.nix index b19bf5f..a7d0764 100644 --- a/multi-nixpkgs/flake.nix +++ b/multi-nixpkgs/flake.nix @@ -4,6 +4,7 @@ inputs = { # Nixpkgs nixpkgs.url = "github:nixos/nixpkgs/nixos-22.11"; + nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable"; # Home manager home-manager.url = "github:nix-community/home-manager"; @@ -43,7 +44,7 @@ ); # Your custom packages and modifications, exported as overlays - overlays = import ./overlays; + overlays = import ./overlays { inherit inputs; }; # Reusable nixos modules you might want to export # These are usually stuff you would upstream into nixpkgs nixosModules = import ./modules/nixos; diff --git a/multi-nixpkgs/home-manager/home.nix b/multi-nixpkgs/home-manager/home.nix index 9256458..53ba612 100644 --- a/multi-nixpkgs/home-manager/home.nix +++ b/multi-nixpkgs/home-manager/home.nix @@ -18,6 +18,7 @@ # You can add overlays here overlays = [ # Add overlays your own flake exports (from overlays and pkgs dir): + outputs.overlays.unstable outputs.overlays.modifications outputs.overlays.additions diff --git a/multi-nixpkgs/nixos/configuration.nix b/multi-nixpkgs/nixos/configuration.nix index 3745e4c..98ea9fb 100644 --- a/multi-nixpkgs/nixos/configuration.nix +++ b/multi-nixpkgs/nixos/configuration.nix @@ -22,6 +22,7 @@ # You can add overlays here overlays = [ # Add overlays your own flake exports (from overlays and pkgs dir): + outputs.overlays.unstable outputs.overlays.modifications outputs.overlays.additions diff --git a/multi-nixpkgs/overlays/default.nix b/multi-nixpkgs/overlays/default.nix index b2653c9..b068a55 100644 --- a/multi-nixpkgs/overlays/default.nix +++ b/multi-nixpkgs/overlays/default.nix @@ -1,5 +1,11 @@ +{ inputs, ... }: # This file defines overlays { + # Sets `unstable` under `pkgs` as the nixpkgs unstable channel + unstable = final: _prev: { + unstable = inputs.nixpkgs-unstable.legacyPackages.${final.system}; + }; + # This one brings our custom packages from the 'pkgs' directory additions = final: _prev: import ../pkgs { pkgs = final; };