From cca80288edcf9677e063cb436fb0a792c1d4b3a8 Mon Sep 17 00:00:00 2001 From: Giulio De Pasquale Date: Tue, 10 Dec 2024 12:01:30 +0000 Subject: [PATCH] refactor(flake.nix): simplify and consolidate package imports - Simplified the import statements for `unstablePkgs`, `masterPkgs`, `localPkgs`, `teslamatePkgs`, and `agenixPkgs` by using a helper function `importNixpkgs`. - Consolidated overlays into `additionalOverlays` and combined them with `extOverlays` in the final import statement. - Improved readability and maintainability of the flake configuration. --- flake.nix | 47 ++++++++++++++++++----------------------------- 1 file changed, 18 insertions(+), 29 deletions(-) diff --git a/flake.nix b/flake.nix index 1e94b5b..097161a 100644 --- a/flake.nix +++ b/flake.nix @@ -36,49 +36,38 @@ let config = { inherit cudaSupport; + allowUnfree = true; }; extOverlays = [ (nvidia-patch.overlays.default) ]; - in - import nixpkgs rec { - inherit system config; - unstablePkgs = import nixos-unstable { - inherit system config; + importNixpkgs = { flake }: + import flake { + inherit system config; - overlays = extOverlays; - }; + overlays = extOverlays; + }; - masterPkgs = import nixos-master { - inherit system config; + unstablePkgs = importNixpkgs { flake = nixos-unstable; }; + masterPkgs = importNixpkgs { flake = nixos-master; }; + localPkgs = importNixpkgs { flake = local-unstable; }; + teslamatePkgs = importNixpkgs { flake = teslamate-flake; }; + agenixPkgs = importNixpkgs { flake = agenix-flake; }; - overlays = extOverlays; - }; - - localPkgs = import local-unstable { - inherit system config; - overlays = extOverlays; - }; - - teslamatePkgs = import teslamate-flake { - inherit system config; - overlays = extOverlays; - }; - - agenixPkgs = import agenix-flake { - inherit system config; - overlays = extOverlays; - }; - - overlays = [ + additionalOverlays = [ (final: prev: { inherit unstablePkgs; }) (final: prev: { inherit localPkgs; }) (final: prev: { inherit teslamatePkgs; }) (final: prev: { inherit agenixPkgs; }) - ] ++ extOverlays; + (final: prev: { inherit masterPkgs; }) + ]; + in + import nixpkgs { + inherit system config; + overlays = additionalOverlays ++ extOverlays; }; wrapUtils = { pkgs }: