Skip to content

Commit

Permalink
templates: add subflake
Browse files Browse the repository at this point in the history
  • Loading branch information
figsoda committed Jun 2, 2023
1 parent 6738742 commit fea6e24
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 0 deletions.
4 changes: 4 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,10 @@
path = ./templates/minimal;
description = "A Nix library that uses nixpkgs.lib instead of the entire nixpkgs";
};
subflake = {
path = ./templates/subflake;
description = "A Nix library that uses namaka in a subflake";
};
};
};
}
39 changes: 39 additions & 0 deletions templates/subflake/dev/flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
inputs = {
call-flake.url = "github:divnix/call-flake";
flake-parts = {
url = "github:hercules-ci/flake-parts";
inputs.nixpkgs-lib.follows = "nixpkgs";
};
namaka = {
url = "github:nix-community/namaka/v0.2.0";
inputs.nixpkgs.follows = "nixpkgs";
};
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
};

outputs = inputs@{ call-flake, flake-parts, namaka, ... }:
flake-parts.lib.mkFlake { inherit inputs; } {
flake.checks = namaka.lib.load {
src = ./tests;
inputs = {
foo = (call-flake ../.).lib;
};
};

systems = [
"aarch64-darwin"
"aarch64-linux"
"x86_64-darwin"
"x86_64-linux"
];

perSystem = { inputs', pkgs, ... }: {
devShells.default = pkgs.mkShell {
packages = [
inputs'.namaka.packages.default
];
};
};
};
}
3 changes: 3 additions & 0 deletions templates/subflake/dev/tests/works/expr.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{ foo }:

foo.answer * 2
18 changes: 18 additions & 0 deletions templates/subflake/flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
inputs = {
haumea = {
url = "github:nix-community/haumea/v0.2.2";
inputs.nixpkgs.follows = "nixpkgs";
};
nixpkgs.url = "github:nix-community/nixpkgs.lib";
};

outputs = { self, haumea, nixpkgs }: {
lib = haumea.lib.load {
src = ./src;
inputs = {
inherit (nixpkgs) lib;
};
};
};
}
5 changes: 5 additions & 0 deletions templates/subflake/namaka.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[check]
cmd = ["nix", "flake", "check", "./dev"]

[eval]
cmd = ["nix", "eval", "./dev#checks"]
3 changes: 3 additions & 0 deletions templates/subflake/src/answer.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{ lib }:

lib.id 42

0 comments on commit fea6e24

Please sign in to comment.