-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
144 lines (130 loc) · 3.9 KB
/
Copy pathflake.nix
File metadata and controls
144 lines (130 loc) · 3.9 KB
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
{
inputs = {
nixpkgs.url = "https://flakehub.com/f/nixos/nixpkgs/0.1.*";
determinate.url = "https://flakehub.com/f/DeterminateSystems/determinate/*";
fh.url = "https://flakehub.com/f/DeterminateSystems/fh/0.1.*";
flake-schemas.url = "https://flakehub.com/f/DeterminateSystems/flake-schemas/0.3";
nixos-amis.url = # "https://flakehub.com/f/NixOS/amis/0.1.*";
"github:DeterminateSystems/amis/grahamc/ignore-me-central-1";
};
outputs =
{ self, ... }@inputs:
let
inherit (inputs.nixpkgs) lib;
linuxSystems = [
"x86_64-linux"
"aarch64-linux"
];
allSystems = linuxSystems ++ [
"aarch64-darwin"
];
forSystems =
systems: f:
lib.genAttrs systems (
system:
f {
inherit system;
pkgs = import inputs.nixpkgs {
inherit system;
};
}
);
forLinuxSystems = forSystems linuxSystems;
forAllSystems = forSystems allSystems;
in
{
# Update this, and the changelog *and* usage examples in the README, for breaking changes to the AMIs
epoch = builtins.toString 1;
nixosConfigurations = forLinuxSystems (
{
system,
pkgs,
...
}:
lib.nixosSystem {
inherit system;
modules = [
"${inputs.nixpkgs}/nixos/maintainers/scripts/ec2/amazon-image.nix"
inputs.determinate.nixosModules.default
(
{ config, ... }:
{
system.nixos.tags = lib.mkForce [ ];
environment.systemPackages = [
inputs.fh.packages.${system}.default
pkgs.git
];
virtualisation.diskSize = lib.mkForce (4 * 1024);
assertions = [
{
assertion = ((builtins.match "^[0-9][0-9]\.[0-9][0-9]\..*" config.system.nixos.label) != null);
message = "nixos image label is incorrect";
}
];
}
)
];
}
);
diskImages = forLinuxSystems (
{ system, ... }:
{
aws = self.nixosConfigurations.${system}.config.system.build.amazonImage;
}
);
devShells = forAllSystems (
{
system,
pkgs,
...
}:
{
default = pkgs.mkShell {
packages =
with pkgs;
[
lychee
self.formatter.${system}
]
++ lib.optionals (builtins.elem system linuxSystems) [
inputs.nixos-amis.packages.${system}.upload-ami
];
};
}
);
formatter = forAllSystems ({ pkgs, ... }: pkgs.nixfmt);
apps = forLinuxSystems (
{ system, ... }:
{
smoke-test = inputs.nixos-amis.apps.${system}.smoke-test;
}
);
schemas = {
inherit (inputs.flake-schemas.schemas)
apps
devShells
formatter
nixosConfigurations
schemas
;
}
// {
diskImages = {
version = 1;
doc = ''
The `diskImages` flake output contains derivations that build disk images for various execution environments.
'';
inventory = inputs.flake-schemas.lib.derivationsInventory "Disk image" false;
};
epoch = {
version = 1;
doc = "The `epoch` output provides a simple string value that's meant to be updated whenever there are breaking changes to the AMIs.";
inventory = output: {
what = "Determinate NixOS AMIs epoch ${output}";
shortDescription = "A string representing the epoch value: ${output}";
evalChecks.isString = builtins.isString output;
};
};
};
};
}