summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAlan Pearce2024-05-10 11:05:51 +0200
committerAlan Pearce2024-05-10 17:58:23 +0200
commit1e7e46c99bbd75dafb7f7d1d0ece222a86959d75 (patch)
tree33842a24751055a26bf785d00b92aeff3653fe69
parent8d9f30f09e7030c90a8105d73d67be20d4366364 (diff)
downloadnixfiles-1e7e46c99bbd75dafb7f7d1d0ece222a86959d75.tar.lz
nixfiles-1e7e46c99bbd75dafb7f7d1d0ece222a86959d75.tar.zst
nixfiles-1e7e46c99bbd75dafb7f7d1d0ece222a86959d75.zip
use local overlays automatically
-rw-r--r--flake.nix17
1 files changed, 12 insertions, 5 deletions
diff --git a/flake.nix b/flake.nix
index ed8ccc47..fd497e57 100644
--- a/flake.nix
+++ b/flake.nix
@@ -35,12 +35,21 @@
     , ...
     }:
     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 @@
           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 @@
           nix-index-database.hmModules.nix-index
           (secrets + "/default.nix")
           (secrets + "/ssh.nix")
-          ({ nixpkgs.overlays = [ emacs-overlay.overlay ]; })
         ];
       };
       homeConfigurations."alan@nanopi" = mkHomeConfiguration {