about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFranck Cuny <franck@fcuny.net>2023-12-04 08:10:43 -0800
committerFranck Cuny <franck@fcuny.net>2023-12-04 08:10:43 -0800
commit1285614380a1b5c6261209dd5ca65925438ec441 (patch)
treed7e55ba7736f4f4db0e0ad166ed556aab5c59e37
parentadd nixd as a LSP for nix. (diff)
downloadworld-1285614380a1b5c6261209dd5ca65925438ec441.tar.gz
additional cleanup for flakes
Move the host configuration to `flake/hosts.nix` to follow what we did
with `devshell`.
-rw-r--r--flake.nix24
-rw-r--r--flake/devshell.nix55
-rw-r--r--flake/hosts.nix21
3 files changed, 57 insertions, 43 deletions
diff --git a/flake.nix b/flake.nix
index 8994fc9..93df93c 100644
--- a/flake.nix
+++ b/flake.nix
@@ -32,28 +32,14 @@
   };
 
   # Output config, or config for NixOS system
-  outputs = inputs@{ self, flake-parts, ... }:
-    flake-parts.lib.mkFlake { inherit inputs; } {
-      flake =
-        let
-          mba = import ./flake/mba.nix {
-            inherit (inputs) nixpkgs home-manager darwin;
-            inherit inputs;
-          };
-        in
-        {
-          darwinConfigurations = {
-            mba-fcuny = mba.system;
-          };
-        };
-
-      systems = [
-        "aarch64-darwin"
-        "x86_64-linux"
-      ];
+  outputs = inputs:
+    inputs.flake-parts.lib.mkFlake { inherit inputs; } {
+
+      systems = [ "aarch64-darwin" "x86_64-linux" ];
 
       imports = [
         ./flake/devshell.nix
+        ./flake/hosts.nix
       ];
     };
 }
diff --git a/flake/devshell.nix b/flake/devshell.nix
index f096bfe..7b75417 100644
--- a/flake/devshell.nix
+++ b/flake/devshell.nix
@@ -5,37 +5,44 @@
     inputs.pre-commit-hooks.flakeModule
   ];
 
-  perSystem = { config, pkgs, inputs', ... }: {
-    devShells.default = pkgs.mkShell {
-      name = "dotfiles";
+  perSystem =
+    { config
+    , inputs'
+    , pkgs
+    , ...
+    }: {
+      devshells.default = {
+        name = "world";
 
-      packages = [
-      ];
+        packages = with pkgs; [
+        ];
 
-      TREEFMT_CONFIG_FILE = config.treefmt.build.configFile;
-    };
+        commands = [
+          { package = config.treefmt.build.wrapper; }
+        ];
+      };
 
-    treefmt = {
-      projectRootFile = ".git/config";
+      treefmt = {
+        projectRootFile = ".git/config";
 
-      # list of supported programs
-      # https://github.com/numtide/treefmt-nix
-      programs = {
-        nixpkgs-fmt.enable = true;
-        shfmt.enable = true;
-        yamlfmt.enable = true;
-        taplo.enable = true;
+        # list of supported programs
+        # https://github.com/numtide/treefmt-nix
+        programs = {
+          nixpkgs-fmt.enable = true;
+          shfmt.enable = true;
+          yamlfmt.enable = true;
+          taplo.enable = true;
+        };
       };
-    };
 
-    pre-commit = {
-      settings = {
-        hooks = {
-          # deadnix.enable = true;
-          shellcheck.enable = true;
-          treefmt.enable = true;
+      pre-commit = {
+        settings = {
+          hooks = {
+            # deadnix.enable = true;
+            shellcheck.enable = true;
+            treefmt.enable = true;
+          };
         };
       };
     };
-  };
 }
diff --git a/flake/hosts.nix b/flake/hosts.nix
new file mode 100644
index 0000000..b0bc74c
--- /dev/null
+++ b/flake/hosts.nix
@@ -0,0 +1,21 @@
+{ inputs, ... }:
+let
+  inherit (inputs) self nixpkgs darwin home-manager;
+  inherit (nixpkgs.lib) mkMerge;
+
+  mkDarwinConfig = system: path:
+    darwin.lib.darwinSystem {
+      inherit system;
+      modules = [ home-manager.darwinModule path ];
+      specialArgs = { inherit inputs; };
+    };
+in
+{
+  flake = mkMerge [
+    {
+      darwinConfigurations = {
+        mba-fcuny = mkDarwinConfig "aarch64-darwin" ../hosts/mba;
+      };
+    }
+  ];
+}