|
8 | 8 | "github:DeterminateSystems/amis/grahamc/ignore-me-central-1"; |
9 | 9 | }; |
10 | 10 |
|
11 | | - outputs = { self, ... }@inputs: |
| 11 | + outputs = |
| 12 | + { self, ... }@inputs: |
12 | 13 | let |
13 | | - linuxSystems = [ "x86_64-linux" "aarch64-linux" ]; |
14 | | - allSystems = linuxSystems ++ [ "x86_64-darwin" "aarch64-darwin" ]; |
| 14 | + inherit (inputs.nixpkgs) lib; |
15 | 15 |
|
16 | | - forSystems = systems: f: inputs.nixpkgs.lib.genAttrs systems (system: f { |
17 | | - inherit system; |
18 | | - pkgs = import inputs.nixpkgs { |
19 | | - inherit system; |
20 | | - }; |
21 | | - lib = inputs.nixpkgs.lib; |
22 | | - }); |
| 16 | + linuxSystems = [ |
| 17 | + "x86_64-linux" |
| 18 | + "aarch64-linux" |
| 19 | + ]; |
| 20 | + allSystems = linuxSystems ++ [ |
| 21 | + "aarch64-darwin" |
| 22 | + ]; |
| 23 | + |
| 24 | + forSystems = |
| 25 | + systems: f: |
| 26 | + lib.genAttrs systems ( |
| 27 | + system: |
| 28 | + f { |
| 29 | + inherit system; |
| 30 | + pkgs = import inputs.nixpkgs { |
| 31 | + inherit system; |
| 32 | + }; |
| 33 | + } |
| 34 | + ); |
23 | 35 |
|
24 | 36 | forLinuxSystems = forSystems linuxSystems; |
25 | 37 | forAllSystems = forSystems allSystems; |
|
28 | 40 | # Update this, and the changelog *and* usage examples in the README, for breaking changes to the AMIs |
29 | 41 | epoch = builtins.toString 1; |
30 | 42 |
|
31 | | - nixosConfigurations = forLinuxSystems ({ system, pkgs, lib, ... }: lib.nixosSystem { |
32 | | - inherit system; |
33 | | - modules = [ |
34 | | - "${inputs.nixpkgs}/nixos/maintainers/scripts/ec2/amazon-image.nix" |
35 | | - inputs.determinate.nixosModules.default |
36 | | - ({ config, ... }: { |
| 43 | + nixosConfigurations = forLinuxSystems ( |
| 44 | + { |
| 45 | + system, |
| 46 | + pkgs, |
| 47 | + ... |
| 48 | + }: |
| 49 | + lib.nixosSystem { |
| 50 | + inherit system; |
| 51 | + modules = [ |
| 52 | + "${inputs.nixpkgs}/nixos/maintainers/scripts/ec2/amazon-image.nix" |
| 53 | + inputs.determinate.nixosModules.default |
| 54 | + ( |
| 55 | + { config, ... }: |
| 56 | + { |
37 | 57 |
|
38 | | - system.nixos.tags = lib.mkForce [ ]; |
39 | | - environment.systemPackages = [ |
40 | | - inputs.fh.packages.${system}.default |
41 | | - pkgs.git |
42 | | - ]; |
| 58 | + system.nixos.tags = lib.mkForce [ ]; |
| 59 | + environment.systemPackages = [ |
| 60 | + inputs.fh.packages.${system}.default |
| 61 | + pkgs.git |
| 62 | + ]; |
43 | 63 |
|
44 | | - virtualisation.diskSize = lib.mkForce (4 * 1024); |
| 64 | + virtualisation.diskSize = lib.mkForce (4 * 1024); |
45 | 65 |
|
46 | | - assertions = |
47 | | - [{ |
48 | | - assertion = (( |
49 | | - builtins.match |
50 | | - "^[0-9][0-9]\.[0-9][0-9]\..*" |
51 | | - config.system.nixos.label |
52 | | - ) != null); |
53 | | - message = "nixos image label is incorrect"; |
54 | | - }]; |
55 | | - }) |
56 | | - ]; |
57 | | - }); |
| 66 | + assertions = [ |
| 67 | + { |
| 68 | + assertion = ((builtins.match "^[0-9][0-9]\.[0-9][0-9]\..*" config.system.nixos.label) != null); |
| 69 | + message = "nixos image label is incorrect"; |
| 70 | + } |
| 71 | + ]; |
| 72 | + } |
| 73 | + ) |
| 74 | + ]; |
| 75 | + } |
| 76 | + ); |
58 | 77 |
|
59 | | - diskImages = forLinuxSystems ({ system, ... }: { |
60 | | - aws = self.nixosConfigurations.${system}.config.system.build.amazonImage; |
61 | | - }); |
| 78 | + diskImages = forLinuxSystems ( |
| 79 | + { system, ... }: |
| 80 | + { |
| 81 | + aws = self.nixosConfigurations.${system}.config.system.build.amazonImage; |
| 82 | + } |
| 83 | + ); |
62 | 84 |
|
63 | | - devShells = forAllSystems ({ system, pkgs, lib, ... }: { |
64 | | - default = pkgs.mkShell { |
65 | | - packages = with pkgs; [ |
66 | | - lychee |
67 | | - nixpkgs-fmt |
68 | | - ] ++ lib.optionals (builtins.elem system linuxSystems) [ |
69 | | - inputs.nixos-amis.packages.${system}.upload-ami |
70 | | - ]; |
71 | | - }; |
72 | | - }); |
| 85 | + devShells = forAllSystems ( |
| 86 | + { |
| 87 | + system, |
| 88 | + pkgs, |
| 89 | + ... |
| 90 | + }: |
| 91 | + { |
| 92 | + default = pkgs.mkShell { |
| 93 | + packages = |
| 94 | + with pkgs; |
| 95 | + [ |
| 96 | + lychee |
| 97 | + self.formatter.${system} |
| 98 | + ] |
| 99 | + ++ lib.optionals (builtins.elem system linuxSystems) [ |
| 100 | + inputs.nixos-amis.packages.${system}.upload-ami |
| 101 | + ]; |
| 102 | + }; |
| 103 | + } |
| 104 | + ); |
| 105 | + |
| 106 | + formatter = forAllSystems ({ pkgs, ... }: pkgs.nixfmt); |
73 | 107 |
|
74 | | - apps = forLinuxSystems ({ system, ... }: { |
75 | | - smoke-test = inputs.nixos-amis.apps.${system}.smoke-test; |
76 | | - }); |
| 108 | + apps = forLinuxSystems ( |
| 109 | + { system, ... }: |
| 110 | + { |
| 111 | + smoke-test = inputs.nixos-amis.apps.${system}.smoke-test; |
| 112 | + } |
| 113 | + ); |
77 | 114 |
|
78 | | - schemas = inputs.flake-schemas.schemas // { |
| 115 | + schemas = { |
| 116 | + inherit (inputs.flake-schemas.schemas) |
| 117 | + apps |
| 118 | + devShells |
| 119 | + formatter |
| 120 | + nixosConfigurations |
| 121 | + schemas |
| 122 | + ; |
| 123 | + } |
| 124 | + // { |
79 | 125 | diskImages = { |
80 | 126 | version = 1; |
81 | 127 | doc = '' |
82 | 128 | The `diskImages` flake output contains derivations that build disk images for various execution environments. |
83 | 129 | ''; |
84 | 130 | inventory = inputs.flake-schemas.lib.derivationsInventory "Disk image" false; |
85 | 131 | }; |
| 132 | + |
| 133 | + epoch = { |
| 134 | + version = 1; |
| 135 | + doc = "The `epoch` output provides a simple string value that's meant to be updated whenever there are breaking changes to the AMIs."; |
| 136 | + inventory = output: { |
| 137 | + what = "Determinate NixOS AMIs epoch ${output}"; |
| 138 | + shortDescription = "A string representing the epoch value: ${output}"; |
| 139 | + evalChecks.isString = builtins.isString output; |
| 140 | + }; |
| 141 | + }; |
86 | 142 | }; |
87 | 143 | }; |
88 | 144 | } |
0 commit comments