add lib.simpleFlake (#5)
This commit is contained in:
19
examples/each-system/flake.nix
Normal file
19
examples/each-system/flake.nix
Normal 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;
|
||||
}
|
||||
);
|
||||
}
|
||||
13
examples/simple-flake/flake.nix
Normal file
13
examples/simple-flake/flake.nix
Normal 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;
|
||||
};
|
||||
}
|
||||
11
examples/simple-flake/overlay.nix
Normal file
11
examples/simple-flake/overlay.nix
Normal 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;
|
||||
};
|
||||
}
|
||||
4
examples/simple-flake/shell.nix
Normal file
4
examples/simple-flake/shell.nix
Normal file
@@ -0,0 +1,4 @@
|
||||
{ pkgs ? import <nixpkgs> }:
|
||||
pkgs.mkShell {
|
||||
buildInputs = [ pkgs.jq ];
|
||||
}
|
||||
Reference in New Issue
Block a user