Hey I'm not here to really gripe about anything missing, but more to highlight how recent changes to the flake spec in Nix 2.7.0 make eachSystemMap a really elegant function.
If you agree I I'll PR some README updates to highlight the new patterns, since I think it'd be good to put it front and center.
For context Nix 2.7.0 deprecates defaultXXX.${system} in favor of packages.${system}.default making it easier to wrangle defining defaults.
This snippet below is for a trivial project I have with a standard package installation. This flake makes it available to nix-command, or it can be consumed in NixOS/home-manager as a module, or in legacy nix + nixpkgs projects as an overlay.
The boilerplate required previously to handle the defautXXX outputs used to be real ugly.
{
description = "A handful of useful core utilities and scripts for Linux";
inputs = {
nixpkgs.url = github:NixOS/nixpkgs/nixpkgs-unstable;
utils.url = github:numtide/flake-utils;
};
outputs = { self, nixpkgs, utils }:
let
eachDefaultSystemMap = utils.lib.eachSystemMap utils.lib.defaultSystems;
in {
packages = eachDefaultSystemMap ( system: rec {
ak-core =
( import nixpkgs { inherit system; } ).callPackage ./default.nix {};
default = ak-core;
} );
overlays.ak-core = final: prev: {
inherit (self.packages.${final.system}) ak-core;
};
overlays.default = self.overlays.ak-core;
nixosModules.ak-core = { ... }: {
nixpkgs.overlays = self.overlays.ak-core;
};
nixosModule = self.nixosModules.ak-core;
};
}
Hey I'm not here to really gripe about anything missing, but more to highlight how recent changes to the flake spec in Nix 2.7.0 make
eachSystemMapa really elegant function.If you agree I I'll PR some
READMEupdates to highlight the new patterns, since I think it'd be good to put it front and center.For context Nix 2.7.0 deprecates
defaultXXX.${system}in favor ofpackages.${system}.defaultmaking it easier to wrangle defining defaults.This snippet below is for a trivial project I have with a standard package installation. This flake makes it available to
nix-command, or it can be consumed inNixOS/home-manageras a module, or in legacynix+nixpkgsprojects as an overlay.The boilerplate required previously to handle the
defautXXXoutputs used to be real ugly.