-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
96 lines (89 loc) · 2.24 KB
/
flake.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#
# Nix flake.
#
# https://nix.dev/manual/nix/stable/command-ref/new-cli/nix3-flake#flake-format
# https://wiki.nixos.org/wiki/Flakes#Flake_schema
#
{
description = "Nix flake.";
inputs = {
# https://search.nixos.org/packages?channel=unstable
nixpkgs = {
type = "github";
owner = "NixOS";
repo = "nixpkgs";
ref = "nixpkgs-unstable";
};
};
outputs =
{ self, nixpkgs }:
let
# Systems to provide outputs for.
systems = [
"aarch64-linux"
"x86_64-linux"
];
# A function that provides a system-specific nixpkgs for each system.
forEachSystem =
f:
nixpkgs.lib.genAttrs systems (
system:
f {
pkgs = import nixpkgs {
inherit system;
};
}
);
in
{
# Formatter.
#
# For `nix fmt`.
formatter = forEachSystem ({ pkgs }: pkgs.nixfmt-rfc-style);
# Development shells.
#
# For `nix develop` and direnv's `use flake`.
devShells = forEachSystem (
{ pkgs }:
{
default = pkgs.mkShell {
packages = with pkgs; [
# Nix.
#
# Nix is dynamically linked on some systems. If we set LD_LIBRARY_PATH,
# running Nix commands with the system-installed Nix may fail due to mismatched library versions.
nix
# Utilities.
coreutils
# Git.
git
git-lfs
];
shellHook = ''
echo "⚗️"
'';
};
}
);
# NixOS modules.
#
# https://nixos.org/manual/nixos/stable#sec-writing-modules
nixosModules = {
fluent-bit = import ./inputs/main/nix/nixos/modules/fluent-bit.nix;
};
# Checks.
#
# For `nix flake check`.
#
# https://nixos.org/manual/nixos/stable/index.html#sec-nixos-tests
# https://nixos.org/manual/nixpkgs/stable#tester-runNixOSTest
checks = forEachSystem (
{ pkgs }:
{
fluent-bit = pkgs.callPackage ./inputs/test/nix/nixos/modules/fluent-bit.nix {
inherit self pkgs;
};
}
);
};
}