From f0e313c88666315485e7d39d821147b1745e5386 Mon Sep 17 00:00:00 2001 From: Gabriel Fontes Date: Mon, 20 Feb 2023 17:08:47 -0300 Subject: [PATCH] add nixpkgs-unstable to standard template I decided it is a common enough usecase, so it makes sense to include it Co-authored-by: Will Forman --- standard/flake.lock | 19 ++++++++++++++++++- standard/flake.nix | 6 +++++- standard/home-manager/home.nix | 1 + standard/nixos/configuration.nix | 1 + standard/overlays/default.nix | 10 ++++++++++ 5 files changed, 35 insertions(+), 2 deletions(-) diff --git a/standard/flake.lock b/standard/flake.lock index 6b8c59c..220e02c 100644 --- a/standard/flake.lock +++ b/standard/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/standard/flake.nix b/standard/flake.nix index b19bf5f..a335d6f 100644 --- a/standard/flake.nix +++ b/standard/flake.nix @@ -4,6 +4,10 @@ inputs = { # Nixpkgs nixpkgs.url = "github:nixos/nixpkgs/nixos-22.11"; + # You can access packages and modules from different nixpkgs revs + # at the same time. Here's an working example: + nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable"; + # Also see the 'unstable-packages' overlay at 'overlays/default.nix'. # Home manager home-manager.url = "github:nix-community/home-manager"; @@ -43,7 +47,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/standard/home-manager/home.nix b/standard/home-manager/home.nix index 9256458..53ba612 100644 --- a/standard/home-manager/home.nix +++ b/standard/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/standard/nixos/configuration.nix b/standard/nixos/configuration.nix index 3745e4c..98ea9fb 100644 --- a/standard/nixos/configuration.nix +++ b/standard/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/standard/overlays/default.nix b/standard/overlays/default.nix index b2653c9..9a03471 100644 --- a/standard/overlays/default.nix +++ b/standard/overlays/default.nix @@ -1,4 +1,5 @@ # This file defines overlays +{ inputs, ... }: { # This one brings our custom packages from the 'pkgs' directory additions = final: _prev: import ../pkgs { pkgs = final; }; @@ -11,4 +12,13 @@ # ... # }); }; + + # When applied, the unstable nixpkgs set (declared in the flake inputs) will + # be accessible through 'pkgs.unstable' + unstable-packages = final: _prev: { + unstable = import inputs.nixpkgs-unstable { + system = final.system; + config.allowUnfree = true; + }; + }; }