all repos — nixfiles @ 1e7e46c99bbd75dafb7f7d1d0ece222a86959d75

System and user configuration, managed by nix and home-manager

use local overlays automatically
Alan Pearce alan@alanpearce.eu
Fri, 10 May 2024 11:05:51 +0200
commit

1e7e46c99bbd75dafb7f7d1d0ece222a86959d75

parent

8d9f30f09e7030c90a8105d73d67be20d4366364

1 files changed, 12 insertions(+), 5 deletions(-)

jump to
M flake.nixflake.nix
@@ -35,12 +35,21 @@ , deploy-rs     , ...
     }:
     let
+      readOverlays = path:
+        let content = builtins.readDir path; in
+        map (n: import (path + ("/" + n)))
+          (builtins.filter
+            (n:
+              (builtins.match ".*\\.nix" n != null &&
+              # ignore Emacs lock files (.#foo.nix)
+              builtins.match "\\.#.*" n == null) ||
+              builtins.pathExists (path + ("/" + n + "/default.nix")))
+            (builtins.attrNames content));
+
       mkHomeConfiguration = { modules, system }: home-manager.lib.homeManagerConfiguration {
         pkgs = import nixpkgs {
           inherit system;
-          overlays = [
-            self.overlays.default
-          ];
+          overlays = readOverlays (toString ./overlays) ++ [ emacs-overlay.overlay ];
         };
 
         inherit modules;
@@ -93,7 +102,6 @@ ./user/mba.nix           nix-index-database.hmModules.nix-index
           (secrets + "/default.nix")
           (secrets + "/ssh.nix")
-          ({ nixpkgs.overlays = [ emacs-overlay.overlay ]; })
         ];
       };
       homeConfigurations."alan@prefect" = mkHomeConfiguration {
@@ -103,7 +111,6 @@ ./user/prefect.nix           nix-index-database.hmModules.nix-index
           (secrets + "/default.nix")
           (secrets + "/ssh.nix")
-          ({ nixpkgs.overlays = [ emacs-overlay.overlay ]; })
         ];
       };
       homeConfigurations."alan@nanopi" = mkHomeConfiguration {