{ description = "Mashup of various utility functions that I use often."; inputs = { systems.url = "github:nix-systems/default"; }; outputs = { self, ... }: let systems = (import self.inputs.systems); in { lib = { # Equivalent to flake-utils' eachDefaultSystem # Taken from flake-utils eachSystem = f: let # Merge together the outptus for all systems op = attrs: system: let ret = f system; op = attrs: key: attrs // { ${key} = (attrs.${key} or { }) // { ${system} = ret.${key}; }; }; in builtins.foldl' op attrs (builtins.attrNames ret); in builtins.foldl' op { } ( systems ++ # add the current system if --impure is used ( if builtins ? currentSystem then if builtins.elem builtins.currentSystem systems then [ ] else [ builtins.currentSystem ] else [ ] ) ); # Like mkShell, but with less dependencies. # Taken from https://fzakaria.com/2021/08/02/a-minimal-nix-shell.html minimalMkShell = pkgs: let stdenvMinimal = pkgs.stdenvNoCC.override { cc = null; preHook = ""; allowedRequisites = null; initialPath = pkgs.lib.filter ( a: pkgs.lib.hasPrefix "coreutils" a.name ) pkgs.stdenvNoCC.initialPath; extraNativeBuildInputs = [ ]; }; in pkgs.mkShell.override { stdenv = stdenvMinimal; }; }; templates = { eachSystem = { path = ./examples/simple; description = "Example showing off a few simple functions."; }; }; }; }