Commit b79bb4796907

Vincent Demeester <vincent@sbr.pm>
2020-04-30 23:36:43
Introduce a machine config…
… to detect if we are in home-manager or nixos Signed-off-by: Vincent Demeester <vincent@sbr.pm>
1 parent 4c43137
machines/is-hm.nix
@@ -0,0 +1,3 @@
+{
+  machine.home-manager = true;
+}
machines/is-nixos.nix
@@ -0,0 +1,3 @@
+{
+  machine.nixos = true;
+}
modules/profiles/zsh.nix
@@ -166,6 +166,11 @@ in
           '';*/
         }
       )
+      (
+        mkIf config.machine.home-manager {
+          home.packages = with pkgs; [ hello ];
+        }
+      )
     ]
   );
 }
modules/machines.nix
@@ -0,0 +1,10 @@
+{ config, lib, ... }:
+
+with lib; {
+  options = {
+    machine = {
+      home-manager = mkEnableOption "It is a home-manager configuration";
+      nixos = mkEnableOption "It is a nixos configuration";
+    };
+  };
+}
modules/module-list.nix
@@ -1,5 +1,6 @@
 {
   imports = [
+    ./machines.nix
     ./profiles/audio.nix
     ./profiles/bash.nix
     ./profiles/containers.nix
configuration.nix
@@ -10,6 +10,8 @@ in
     ./hardware-configuration.nix
     # Default profile with default configuration
     ./modules/module-list.nixos.nix
+    # Set the machine to nixos
+    ./machines/is-nixos.nix
     # Machine specific configuration files
     (./machines + "/${hostName}.nixos.nix")
   ];
home.nix
@@ -8,6 +8,8 @@ in
   imports = [
     # Default profile with default configuration
     ./modules/module-list.nix
+    # Set the machine to home
+    ./machines/is-hm.nix
     # Machine specific configuration files
     (./machines + "/${hostName}.nix")
   ];