~hutzdog/lib.nix

d645463f7f2d25fbe42839a97fd2ba83c189638f — Danielle Hutzley 1 year, 7 months ago
Initial commit
3 files changed, 42 insertions(+), 0 deletions(-)

A flake.nix
A templates/base/.envrc
A templates/base/flake.nix
A  => flake.nix +18 -0
@@ 1,18 @@
{
  # TODO: once anything requires it, add the inputs for utils and nixpkgs
  # TODO: in the library, a wrapper around utils.lib.eachDefaultSystem should be written which avoids ugly override syntax
  # TODO: provide funcitons (one for both global and per-system usage) to expose known inputs in a useful way (along the lines of `with libnix.lib.exposeKnownInputs inputs;`)
  description = "Our personal collection of Nix utilities";

  outputs = { self }: {
    # Templates
    templates = {
      # TODO: base on utility library, once made
      base = {
        path = ./templates/base;
        description = "A basic Flake with direnv";
      };
    };
    defaultTemplate = self.templates.base;
  };
}

A  => templates/base/.envrc +1 -0
@@ 1,1 @@
use flake

A  => templates/base/flake.nix +23 -0
@@ 1,23 @@
{
  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
    utils.url = "github:numtide/flake-utils";
  };

  outputs = inputs @ { self, ... }: let
    # TODO: with inputs.libnix.lib.extractAgnosticInputs inputs;
    utils = inputs.utils.lib;
  in (utils.lib.eachDefaultSystem (system: let
    # TODO: with inputs.libnix.lib.extractSystemInputs inputs system;
    pkgs = import inputs.nixpkgs {inherit system;};
  in {
    # per-system items here
    devShell = pkgs.mkShell {
      nativeBuildInputs = with pkgs; [
        # self.defaultPackage."${system}"
      ];
    };
  })) // {
    # system agnostic items here
  };
}