From 7d03a200495292d0e6f2901c517fd5207e5d4f0b Mon Sep 17 00:00:00 2001 From: Antoine Cotten Date: Sat, 7 Sep 2024 00:49:16 +0200 Subject: [PATCH] nix: Switch formatter from nixpkgs-fmt to nixfmt nixpkgs-fmt was archived[1] in favour of nixfmt[2], which implements the Nix RFC 166[3]. See NixOS/nixfmt#153 for further details about the progress of the implementation. [1]: https://x.com/zimbatm/status/1816148339131343058 [2]: https://github.com/NixOS/nixfmt?tab=readme-ov-file#readme [3]: https://github.com/nix-rfc-101/rfcs/blob/aaf1613f/rfcs/0166-nix-formatting.md --- flake.nix | 60 +++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 38 insertions(+), 22 deletions(-) diff --git a/flake.nix b/flake.nix index d6f0af0..faaab14 100644 --- a/flake.nix +++ b/flake.nix @@ -1,44 +1,60 @@ { description = "GitHub Pages"; - inputs.nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1.*.tar.gz"; # nixos-unstable + inputs = { + nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1.*.tar.gz"; # nixos-unstable - inputs.ruby-nix = { - url = "github:inscapist/ruby-nix"; - inputs.nixpkgs.follows = "nixpkgs"; - }; + ruby-nix = { + url = "github:inscapist/ruby-nix"; + inputs.nixpkgs.follows = "nixpkgs"; + }; - inputs.bundix = { - url = "github:inscapist/bundix/main"; - inputs.nixpkgs.follows = "nixpkgs"; - }; + bundix = { + url = "github:inscapist/bundix/main"; + inputs.nixpkgs.follows = "nixpkgs"; + }; - inputs.flake-schemas.url = "https://flakehub.com/f/DeterminateSystems/flake-schemas/0.1.*.tar.gz"; + flake-schemas.url = "https://flakehub.com/f/DeterminateSystems/flake-schemas/0.1.*.tar.gz"; + }; - outputs = { self, nixpkgs, ruby-nix, bundix, flake-schemas }: + outputs = + { + self, + nixpkgs, + ruby-nix, + bundix, + flake-schemas, + }: let allSystems = [ "x86_64-linux" "aarch64-darwin" ]; - forAllSystems = f: nixpkgs.lib.genAttrs allSystems (system: f { - # Current 'ruby' package version: 3.3.4 - # Should match https://github.com/actions/jekyll-build-pages/blob/v1.0.13/Dockerfile - pkgs = import nixpkgs { inherit system; }; - }); + forAllSystems = + f: + nixpkgs.lib.genAttrs allSystems ( + system: + f { + # Current 'ruby' package version: 3.3.4 + # Should match https://github.com/actions/jekyll-build-pages/blob/v1.0.13/Dockerfile + pkgs = nixpkgs.legacyPackages.${system}; + } + ); in { inherit (flake-schemas) schemas; - formatter = forAllSystems ({ pkgs }: pkgs.nixpkgs-fmt); + formatter = forAllSystems ({ pkgs }: pkgs.nixfmt-rfc-style); - devShells = forAllSystems ({ pkgs }: + devShells = forAllSystems ( + { pkgs }: let - ruby-env = (ruby-nix.lib pkgs { - name = "github-pages"; - gemset = ./gemset.nix; - }).env; + ruby-env = + (ruby-nix.lib pkgs { + name = "github-pages"; + gemset = ./gemset.nix; + }).env; bundix-cli = bundix.packages.${pkgs.system}.default;