-
Notifications
You must be signed in to change notification settings - Fork 3
/
flake.nix
62 lines (54 loc) · 1.54 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
{
description = "Flake for collie-hub";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-24.05";
};
outputs = { self, nixpkgs }:
let
# These tools are pre-installed in github actions, so we can save the time for installing them.
github_actions_preinstalled = pkgs:
with pkgs;
[
nodejs
];
# core packasges required in CI and not preinstalled in github actions
core_packages = pkgs:
with pkgs;
[
# terraform tools
opentofu
terragrunt
tflint
terraform-docs
pre-commit
];
defaultShellForSystem = system:
let
pkgs = import nixpkgs { inherit system; config = { }; };
in
{
default = pkgs.mkShell {
name = "collie-hub";
packages = (github_actions_preinstalled pkgs) ++ (core_packages pkgs);
};
};
in
{
devShells = {
aarch64-darwin = (defaultShellForSystem "aarch64-darwin");
x86_64-darwin = (defaultShellForSystem "x86_64-darwin");
x86_64-linux = (defaultShellForSystem "x86_64-linux") // {
# use a smaller/faster shell on github actions
github_actions =
let
system = "x86_64-linux";
pkgs = import nixpkgs { inherit system; config = { }; };
in
pkgs.mkShell {
name = "collie-hub-ghactions";
packages = (core_packages pkgs);
};
};
};
};
}