From 17198cf5ae27af5b647c7dac58d935a7d0dbd189 Mon Sep 17 00:00:00 2001 From: Anderson Torres Date: Fri, 14 Apr 2023 07:42:03 -0300 Subject: [PATCH] flake.nix: get rid of flake-utils The function `flake-utils.lib.eachDefaultSystem` is superfluous and can be substituted by native `nixpkgs.lib` functionality. --- flake.nix | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/flake.nix b/flake.nix index 496206c3..3cb02d32 100644 --- a/flake.nix +++ b/flake.nix @@ -2,9 +2,8 @@ description = "Home Manager for Nix"; inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; - inputs.utils.url = "github:numtide/flake-utils"; - outputs = { self, nixpkgs, utils, ... }: + outputs = { self, nixpkgs, ... }: { nixosModules = rec { home-manager = import ./nixos; @@ -84,23 +83,29 @@ }; }); }; - } // utils.lib.eachDefaultSystem (system: - let - pkgs = nixpkgs.legacyPackages.${system}; - docs = import ./docs { inherit pkgs; }; - tests = import ./tests { inherit pkgs; }; - hmPkg = pkgs.callPackage ./home-manager { }; - in { - devShells.tests = tests.run; - packages = { + } // (let + forAllSystems = nixpkgs.lib.genAttrs nixpkgs.lib.systems.flakeExposed; + in { + devShells = forAllSystems (system: + let + pkgs = nixpkgs.legacyPackages.${system}; + tests = import ./tests { inherit pkgs; }; + in tests.run); + + packages = forAllSystems (system: + let + pkgs = nixpkgs.legacyPackages.${system}; + docs = import ./docs { inherit pkgs; }; + hmPkg = pkgs.callPackage ./home-manager { }; + in { default = hmPkg; home-manager = hmPkg; docs-html = docs.manual.html; docs-json = docs.options.json; docs-manpages = docs.manPages; - }; - # deprecated in Nix 2.7 - defaultPackage = self.packages.${system}.default; - }); + }); + + defaultPackage = forAllSystems (system: self.packages.${system}.default); + }); }