aboutsummaryrefslogtreecommitdiff
path: root/flake.nix
blob: 4016d271f2527451b9b07d1d8bb311f62427942e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
{
  description = "Mashup of various utility functions that I use often.";

  inputs = {
    systems.url = "github:nix-systems/default";
  };

  outputs =
    {
      self,
      nixpkgs,
      systems,
    }:
    let
      stdenvMinimal = nixpkgs.stdenvNoCC.override {
        cc = null;
        preHook = "";
        allowedRequsites = null;
        initialPath = nixpkgs.lib.filter (
          a: nixpkgs.lib.hasPrefix "coreutils" a.name
        ) nixpkgs.stdenvNoCC.initialPath;
        extraNativeBuildInputs = [ ];
      };
    in
    {
      lib = {
        # Basically equivalent to flake-utils' eachDefaultSystem
        eachSystem = nixpkgs.lib.genAttrs (import systems);

        # Like mkShell, but with less dependencies.
        # See https://fzakaria.com/2021/08/02/a-minimal-nix-shell.html
        minimalMkShell = pkgs: pkgs.mkShell.override { stdenv = stdenvMinimal; };
      };

      templates = {
        eachSystem = {
          path = ./examples/simple;
          description = "Example showing off a few simple functions.";
        };
      };
    };
}