File tree Expand file tree Collapse file tree 3 files changed +43
-12
lines changed
Expand file tree Collapse file tree 3 files changed +43
-12
lines changed Original file line number Diff line number Diff line change 2020 system : aarch64-linux
2121 steps :
2222 - uses : actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
23- - uses : DeterminateSystems/nix-installer-action@7993355175c2765e5733dae74f3e0786fe0e5c4f # v12
24- - uses : DeterminateSystems/magic-nix-cache-action@87b14cf437d03d37989d87f0fa5ce4f5dc1a330b # v8
23+ - uses : cachix/install-nix-action@4e002c8ec80594ecd40e759629461e26c8abed15 # v31.9.0
2524 - run : nix flake check -L --system ${{ matrix.runs-on.system }}
2625 publish :
2726 if : github.event_name == 'push'
Original file line number Diff line number Diff line change @@ -12,13 +12,13 @@ Yes! for example with a config like this:
1212
1313``` nix
1414{
15- inputs.nixpkgs.url = "github:NixOS/nixpkgs/ nixos-unstable";
15+ inputs.nixpkgs.url = "https://channels. nixos.org/nixos -unstable/nixexprs.tar.xz ";
1616
1717 outputs = { nixpkgs, ... }: {
1818 nixosConfigurations.my-system = nixpkgs.lib.nixosSystem {
1919 modules = [
20- "${nixpkgs}/nixos/maintainers/scripts/ec2/amazon-image.nix"
21- {
20+ { modulesPath, ... }:
21+ imports = [ "${modulesPath}/virtualisation/amazon-image.nix" ];
2222 virtualisation.diskSize = "auto"; # or gigabytes. default is 3 * 1024
2323 nixpkgs.hostPlatform = "x86_64-linux";
2424 services.nginx.enable = true;
@@ -32,7 +32,17 @@ Yes! for example with a config like this:
3232you can upload it to your account like this:
3333
3434``` bash
35- nix build .# nixosConfigurations.my-system.config.system.build.amazonImage
35+ nix build .# nixosConfigurations.my-system.config.system.build.images.amazon
36+ ```
37+
38+ Or you can use the the shorthand:
39+
40+ ``` bash
41+ nixos-rebuild build-image --image-variant amazon --flake .# my-system
42+ ```
43+ Then upload it with:
44+
45+ ``` bash
3646nix run github:NixOS/amis#upload-ami -- --prefix my-system --s3-bucket my-bucket --image-info ./result/nix-support/image-info.json
3747```
3848
Original file line number Diff line number Diff line change 1919 let
2020 inherit ( nixpkgs ) lib ;
2121 inherit ( lib ) genAttrs mapAttrs ;
22- supportedSystems = [
22+ linuxSystems = [
2323 "aarch64-linux"
2424 "x86_64-linux"
25- "aarch64-darwin"
2625 ] ;
26+ supportedSystems = [
27+ "aarch64-darwin"
28+ ]
29+ ++ linuxSystems ;
2730 eachSystem = f : genAttrs supportedSystems ( system : f nixpkgs . legacyPackages . ${ system } ) ;
2831 treefmtEval = eachSystem (
2932 pkgs :
6366 mapAttrs mkApp self . packages . ${ system } . upload-ami . passthru . upload-ami . pyproject . project . scripts
6467 ) ;
6568
69+ # NOTE: We don't build the production images with these (yet). We use a hydra job instead
70+ # NOTE: Github Actions doesn't support kvm on arm64 builds
71+ nixosConfigurations . x86_64-linux = nixpkgs . lib . nixosSystem {
72+ modules = [
73+ (
74+ { modulesPath , ... } :
75+ {
76+ imports = [ "${ modulesPath } /virtualisation/amazon-image.nix" ] ;
77+ nixpkgs . hostPlatform = "x86_64-linux" ;
78+ system . stateVersion = "26.05" ;
79+ }
80+ )
81+ ] ;
82+ } ;
83+
6684 formatter = eachSystem ( pkgs : treefmtEval . ${ pkgs. system } . config . build . wrapper ) ;
6785
68- checks = genAttrs supportedSystems ( system : {
69- inherit ( self . packages . ${ system } ) upload-ami ;
70- formatting = treefmtEval . ${ system } . config . build . check self ;
71- } ) ;
86+ checks =
87+ genAttrs linuxSystems ( system : {
88+ inherit ( self . packages . ${ system } ) upload-ami ;
89+ formatting = treefmtEval . ${ system } . config . build . check self ;
90+ } )
91+ // {
92+ x86_64-linux . system = self . nixosConfigurations . x86_64-linux . config . system . build . images . amazon ;
93+ } ;
7294
7395 devShells = genAttrs supportedSystems ( system : {
7496 default = self . packages . ${ system } . upload-ami ;
You can’t perform that action at this time.
0 commit comments