about summary refs log tree commit diff
path: root/flake.nix
diff options
context:
space:
mode:
authorAzat Bahawi <azat@bahawi.net>2023-03-20 13:57:57 +0300
committerAzat Bahawi <azat@bahawi.net>2023-03-20 13:57:57 +0300
commit8520e18ad256ae8e7a7ee1716fddc566b39a1a6b (patch)
tree9720d86f85b3f422c892b093540ed8f840e75757 /flake.nix
parent2023-03-20 (diff)
2023-03-20
Diffstat (limited to '')
-rw-r--r--flake.nix22
1 files changed, 9 insertions, 13 deletions
diff --git a/flake.nix b/flake.nix
index 4eb3fd0..4b5fa34 100644
--- a/flake.nix
+++ b/flake.nix
@@ -254,13 +254,10 @@
           inherit (self.checks.${system}.preCommit) shellHook;
         };
 
-        formatter = pkgs.writeShellApplication {
-          name = "fmt";
-          runtimeInputs = with pkgs; [alejandra];
-          text = ''
-            alejandra --quiet "$@"
+        formatter = with pkgs;
+          writeShellScriptBin "fmt" ''
+            ${alejandra}/bin/alejandra --quiet "$@"
           '';
-        };
 
         checks.preCommit = pre-commit-hooks.lib.${system}.run {
           src = ./.;
@@ -283,20 +280,19 @@
           settings.deadnix.edit = true;
         };
       })
-      // {
+      // (let
+        importConfigurations = dir: import dir {inherit inputs lib;};
+      in {
         inherit lib;
 
         modules.nixfiles = import ./modules/common;
 
         nixosModules.nixfiles = import ./modules/nixos;
-        nixosConfigurations =
-          import ./nixosConfigurations {inherit inputs lib;};
+        nixosConfigurations = importConfigurations ./nixosConfigurations;
 
         darwinModules.nixfiles = import ./modules/darwin;
-        darwinConfigurations =
-          import ./darwinConfigurations {inherit inputs lib;};
+        darwinConfigurations = importConfigurations ./darwinConfigurations;
 
-        # TODO Make it so that self.packages also can use this.
         overlays.default = final: _: {
           bruh = final.callPackage ./packages/bruh.nix {};
           mpv-autosub = final.callPackage ./packages/mpv-autosub.nix {};
@@ -304,5 +300,5 @@
           nixfiles = final.callPackage ./packages/nixfiles.nix {};
           throttled = final.callPackage ./packages/throttled.nix {};
         };
-      };
+      });
 }

Consider giving Nix/NixOS a try! <3