From 3ea689365998db56cc4c84aa4de4ddd15d550baa Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Thu, 29 Aug 2024 13:34:48 +0200 Subject: [PATCH] refact: Add let binding to flake.nix --- flake.nix | 90 +++++++++++++++++++++++++++++-------------------------- 1 file changed, 47 insertions(+), 43 deletions(-) diff --git a/flake.nix b/flake.nix index 3823d09..b12fa52 100644 --- a/flake.nix +++ b/flake.nix @@ -5,49 +5,53 @@ nixpkgs-lib.url = "https://github.com/NixOS/nixpkgs/archive/a5d394176e64ab29c852d03346c1fc9b0b7d33eb.tar.gz"; # 9f918d616c5321ad374ae6cb5ea89c9e04bf3e58 /lib from nixos-unstable }; - outputs = { nixpkgs-lib, ... }: { - lib = import ./lib.nix { - inherit (nixpkgs-lib) lib; - # Extra info for version check message - revInfo = - if nixpkgs-lib?rev - then " (nixpkgs-lib.rev: ${nixpkgs-lib.rev})" - else ""; + outputs = { nixpkgs-lib, ... }: + let + lib = import ./lib.nix { + inherit (nixpkgs-lib) lib; + # Extra info for version check message + revInfo = + if nixpkgs-lib?rev + then " (nixpkgs-lib.rev: ${nixpkgs-lib.rev})" + else ""; + }; + templates = { + default = { + path = ./template/default; + description = '' + A minimal flake using flake-parts. + ''; + }; + multi-module = { + path = ./template/multi-module; + description = '' + A minimal flake using flake-parts. + ''; + }; + unfree = { + path = ./template/unfree; + description = '' + A minimal flake using flake-parts importing nixpkgs with the unfree option. + ''; + }; + package = { + path = ./template/package; + description = '' + A flake with a simple package: + - Nixpkgs + - callPackage + - src with fileset + - a check with runCommand + ''; + }; + }; + flakeModules = { + easyOverlay = ./extras/easyOverlay.nix; + flakeModules = ./extras/flakeModules.nix; + }; + in + { + inherit lib templates flakeModules; }; - templates = { - default = { - path = ./template/default; - description = '' - A minimal flake using flake-parts. - ''; - }; - multi-module = { - path = ./template/multi-module; - description = '' - A minimal flake using flake-parts. - ''; - }; - unfree = { - path = ./template/unfree; - description = '' - A minimal flake using flake-parts importing nixpkgs with the unfree option. - ''; - }; - package = { - path = ./template/package; - description = '' - A flake with a simple package: - - Nixpkgs - - callPackage - - src with fileset - - a check with runCommand - ''; - }; - }; - flakeModules = { - easyOverlay = ./extras/easyOverlay.nix; - flakeModules = ./extras/flakeModules.nix; - }; - }; }