You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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}:
leteachDefaultSystemMap=utils.lib.eachSystemMaputils.lib.defaultSystems;in{packages=eachDefaultSystemMap(system: rec{ak-core=(importnixpkgs{inheritsystem;}).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;};}
The text was updated successfully, but these errors were encountered:
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 ofpackages.${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 inNixOS
/home-manager
as a module, or in legacynix
+nixpkgs
projects as an overlay.The boilerplate required previously to handle the
defautXXX
outputs used to be real ugly.The text was updated successfully, but these errors were encountered: