53 lines
1.4 KiB
Nix
53 lines
1.4 KiB
Nix
|
|
{
|
||
|
|
# Shows multiple flake inputs plus a `follows` edge that makes one
|
||
|
|
# transitive input reuse a top-level input from this flake.
|
||
|
|
description = "A minimal follows and inputs example";
|
||
|
|
|
||
|
|
inputs = {
|
||
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||
|
|
|
||
|
|
systems.url = "github:nix-systems/default";
|
||
|
|
|
||
|
|
flake-utils = {
|
||
|
|
url = "github:numtide/flake-utils";
|
||
|
|
inputs.systems.follows = "systems";
|
||
|
|
};
|
||
|
|
};
|
||
|
|
|
||
|
|
outputs =
|
||
|
|
{
|
||
|
|
self,
|
||
|
|
nixpkgs,
|
||
|
|
flake-utils,
|
||
|
|
...
|
||
|
|
}:
|
||
|
|
flake-utils.lib.eachDefaultSystem (
|
||
|
|
system:
|
||
|
|
let
|
||
|
|
pkgs = import nixpkgs { inherit system; };
|
||
|
|
in
|
||
|
|
{
|
||
|
|
packages.default = pkgs.writeShellScriptBin "show-follows" ''
|
||
|
|
echo "flake-utils is sharing the top-level systems input"
|
||
|
|
'';
|
||
|
|
|
||
|
|
apps.default = {
|
||
|
|
type = "app";
|
||
|
|
program = "${self.packages.${system}.default}/bin/show-follows";
|
||
|
|
meta.description = "Run the package built in the follows example.";
|
||
|
|
};
|
||
|
|
|
||
|
|
checks.runs = pkgs.runCommand "show-follows-runs" { } ''
|
||
|
|
output="$(${self.packages.${system}.default}/bin/show-follows)"
|
||
|
|
|
||
|
|
if [ "$output" = "flake-utils is sharing the top-level systems input" ]; then
|
||
|
|
echo ok > "$out"
|
||
|
|
else
|
||
|
|
echo "unexpected output: $output" >&2
|
||
|
|
exit 1
|
||
|
|
fi
|
||
|
|
'';
|
||
|
|
}
|
||
|
|
);
|
||
|
|
}
|