-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
80 lines (76 loc) · 1.93 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
{
description = "NixOS organization";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
inputs.systems.url = "github:nix-systems/default";
inputs.treefmt-nix = {
url = "github:numtide/treefmt-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
inputs.opentofu-registry = {
url = "github:opentofu/registry";
flake = false;
};
outputs =
{
self,
nixpkgs,
systems,
treefmt-nix,
...
}@inputs:
let
eachSystem = f: nixpkgs.lib.genAttrs (import systems) (system: f nixpkgs.legacyPackages.${system});
in
{
devShells = eachSystem (
pkgs: {
default = pkgs.mkShell {
packages = [
pkgs.findutils
pkgs.gh
pkgs.gnumake
pkgs.jq
pkgs.hcl2json
(pkgs.callPackage ./tofu { inherit (inputs) opentofu-registry; })
];
};
}
);
formatter = eachSystem (
pkgs:
treefmt-nix.lib.mkWrapper pkgs {
projectRootFile = "flake.nix";
# See https://github.com/numtide/treefmt-nix#supported-programs
programs.nixfmt-rfc-style.enable = true;
}
);
packages = eachSystem (
pkgs:
let
eval = nixpkgs.lib.evalModules {
modules = [
./schema.nix
./data.nix
];
specialArgs.pkgs = pkgs;
};
readmeFile = eval.config.readme;
in
{
checkReadme = pkgs.writeShellApplication {
name = "check-readme";
text = ''
cat ${readmeFile}
'';
};
updateReadme = pkgs.writeShellApplication {
name = "update-readme";
text = ''
gitRoot=$(git rev-parse --show-toplevel)
cp ${readmeFile} "$gitRoot/README.md"
'';
};
}
);
};
}