add lib.simpleFlake (#5)

This commit is contained in:
zimbatm
2020-08-23 15:28:05 +02:00
committed by GitHub
parent ec20f52e2f
commit e34fcedfc7
7 changed files with 174 additions and 23 deletions

View File

@@ -0,0 +1,19 @@
{
description = "Flake utils demo";
inputs.flake-utils.url = "github:numtide/flake-utils";
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let pkgs = nixpkgs.legacyPackages.${system}; in
rec {
packages = flake-utils.lib.flattenTree {
hello = pkgs.hello;
gitAndTools = pkgs.gitAndTools;
};
defaultPackage = packages.hello;
apps.hello = flake-utils.lib.mkApp { drv = packages.hello; };
defaultApp = apps.hello;
}
);
}

View File

@@ -0,0 +1,13 @@
{
description = "Flake utils demo";
inputs.flake-utils.url = "github:numtide/flake-utils";
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.simpleFlake {
inherit self nixpkgs;
name = "simple-flake";
overlay = ./overlay.nix;
shell = ./shell.nix;
};
}

View File

@@ -0,0 +1,11 @@
final: prev:
{
# this key should be the same as the simpleFlake name attribute.
simple-flake = {
# assuming that hello is a project-specific package;
hello = prev.hello;
# demonstrating recursive packages
terraform-providers = prev.terraform-providers;
};
}

View File

@@ -0,0 +1,4 @@
{ pkgs ? import <nixpkgs> }:
pkgs.mkShell {
buildInputs = [ pkgs.jq ];
}