diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index fc7a078..ea40046 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -31,7 +31,7 @@ jobs: - name: Check Nix formatting run: | - nix develop --command nixpkgs-fmt --check flake.nix + git ls-files '*.nix' | xargs nix develop --command nixfmt --check - name: nix flake check run: | @@ -40,7 +40,7 @@ jobs: - name: Check external links in README run: | nix develop --command \ - lychee README.md + check-external-links - name: check image label run: | diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d09b708 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +# Link checker cache +.lycheecache + diff --git a/README.md b/README.md index ef9240a..288826b 100644 --- a/README.md +++ b/README.md @@ -85,4 +85,4 @@ data "aws_ami" "detsys_nixos" { [private-flakes]: https://docs.determinate.systems/flakehub/private-flakes [ssm]: https://aws.amazon.com/systems-manager [sts]: https://docs.aws.amazon.com/STS/latest/APIReference/welcome.html -[terraform]: https://terraform.io +[terraform]: https://developer.hashicorp.com/terraform diff --git a/flake.lock b/flake.lock index 12d7d35..baa41cf 100644 --- a/flake.lock +++ b/flake.lock @@ -320,12 +320,12 @@ }, "nixpkgs_5": { "locked": { - "lastModified": 1756787288, - "narHash": "sha256-rw/PHa1cqiePdBxhF66V7R+WAP8WekQ0mCDG4CFqT8Y=", - "rev": "d0fc30899600b9b3466ddb260fd83deb486c32f1", - "revCount": 855242, + "lastModified": 1757487488, + "narHash": "sha256-zwE/e7CuPJUWKdvvTCB7iunV4E/+G0lKfv4kk/5Izdg=", + "rev": "ab0f3607a6c7486ea22229b92ed2d355f1482ee0", + "revCount": 859555, "type": "tarball", - "url": "https://api.flakehub.com/f/pinned/nixos/nixpkgs/0.1.855242%2Brev-d0fc30899600b9b3466ddb260fd83deb486c32f1/01990df1-e511-7b09-83a4-f9910966d674/source.tar.gz" + "url": "https://api.flakehub.com/f/pinned/nixos/nixpkgs/0.1.859555%2Brev-ab0f3607a6c7486ea22229b92ed2d355f1482ee0/01993860-4c2b-73a3-9c67-955d87cd3025/source.tar.gz" }, "original": { "type": "tarball", diff --git a/flake.nix b/flake.nix index 94935e8..03960bf 100644 --- a/flake.nix +++ b/flake.nix @@ -7,18 +7,30 @@ nixos-amis.url = "https://flakehub.com/f/NixOS/amis/0.1.*"; }; - outputs = { self, ... }@inputs: + outputs = + { self, ... }@inputs: let - linuxSystems = [ "x86_64-linux" "aarch64-linux" ]; - allSystems = linuxSystems ++ [ "x86_64-darwin" "aarch64-darwin" ]; + linuxSystems = [ + "x86_64-linux" + "aarch64-linux" + ]; + allSystems = linuxSystems ++ [ + "x86_64-darwin" + "aarch64-darwin" + ]; - forSystems = systems: f: inputs.nixpkgs.lib.genAttrs systems (system: f { - inherit system; - pkgs = import inputs.nixpkgs { - inherit system; - }; - lib = inputs.nixpkgs.lib; - }); + forSystems = + systems: f: + inputs.nixpkgs.lib.genAttrs systems ( + system: + f { + inherit system; + pkgs = import inputs.nixpkgs { + inherit system; + }; + lib = inputs.nixpkgs.lib; + } + ); forLinuxSystems = forSystems linuxSystems; forAllSystems = forSystems allSystems; @@ -27,52 +39,90 @@ # 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, ... }: lib.nixosSystem { - inherit system; - modules = [ - "${inputs.nixpkgs}/nixos/maintainers/scripts/ec2/amazon-image.nix" - inputs.determinate.nixosModules.default - ({ config, ... }: { + nixosConfigurations = forLinuxSystems ( + { + system, + pkgs, + lib, + ... + }: + 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 - ]; + system.nixos.tags = lib.mkForce [ ]; + environment.systemPackages = [ + inputs.fh.packages.${system}.default + pkgs.git + ]; - virtualisation.diskSize = lib.mkForce (4 * 1024); + 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"; - }]; - }) - ]; - }); + 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; - }); + diskImages = forLinuxSystems ( + { system, ... }: + { + aws = self.nixosConfigurations.${system}.config.system.build.amazonImage; + } + ); - devShells = forAllSystems ({ system, pkgs, lib, ... }: { - default = pkgs.mkShell { - packages = with pkgs; [ - lychee - nixpkgs-fmt - ] ++ lib.optionals (builtins.elem system linuxSystems) [ - inputs.nixos-amis.packages.${system}.upload-ami - ]; - }; - }); + devShells = forAllSystems ( + { + system, + pkgs, + lib, + ... + }: + { + default = pkgs.mkShell { + packages = + with pkgs; + [ + lychee + (writeShellApplication { + name = "check-external-links"; + runtimeInputs = with pkgs; [ lychee ]; + text = '' + lychee \ + --cache \ + --max-concurrency 2 \ + --verbose \ + README.me + ''; + }) + self.formatter.${system} + ] + ++ lib.optionals (builtins.elem system linuxSystems) [ + inputs.nixos-amis.packages.${system}.upload-ami + ]; + }; + } + ); + + formatter = forAllSystems ({ pkgs, ... }: pkgs.nixfmt-rfc-style); - apps = forLinuxSystems ({ system, ... }: { - smoke-test = inputs.nixos-amis.apps.${system}.smoke-test; - }); + apps = forLinuxSystems ( + { system, ... }: + { + smoke-test = inputs.nixos-amis.apps.${system}.smoke-test; + } + ); schemas = inputs.flake-schemas.schemas // { diskImages = { diff --git a/result b/result new file mode 120000 index 0000000..5714715 --- /dev/null +++ b/result @@ -0,0 +1 @@ +/nix/store/93rkfkf9arhvawzk6y9fq59m7bd0gij3-nix-shell \ No newline at end of file