commit b79bb479690773f489bd39f90bfdf099f1372091
parent 4c431371ef98eee85482e847fef87d197065b757
Author: Vincent Demeester <vincent@sbr.pm>
Date: Thu, 30 Apr 2020 23:36:43 +0200
Introduce a machine config…
… to detect if we are in home-manager or nixos
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Diffstat:
7 files changed, 26 insertions(+), 0 deletions(-)
diff --git a/configuration.nix b/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")
];
diff --git a/home.nix b/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")
];
diff --git a/machines/is-hm.nix b/machines/is-hm.nix
@@ -0,0 +1,3 @@
+{
+ machine.home-manager = true;
+}
diff --git a/machines/is-nixos.nix b/machines/is-nixos.nix
@@ -0,0 +1,3 @@
+{
+ machine.nixos = true;
+}
diff --git a/modules/machines.nix b/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";
+ };
+ };
+}
diff --git a/modules/module-list.nix b/modules/module-list.nix
@@ -1,5 +1,6 @@
{
imports = [
+ ./machines.nix
./profiles/audio.nix
./profiles/bash.nix
./profiles/containers.nix
diff --git a/modules/profiles/zsh.nix b/modules/profiles/zsh.nix
@@ -166,6 +166,11 @@ in
'';*/
}
)
+ (
+ mkIf config.machine.home-manager {
+ home.packages = with pkgs; [ hello ];
+ }
+ )
]
);
}