From 479c86c00337991dfc04a5a23f8c3cc5ded674a6 Mon Sep 17 00:00:00 2001 From: reo101 Date: Sun, 1 Sep 2024 17:36:20 +0300 Subject: [PATCH] feat(configurations): add `enable` to `meta` Disable old `darwin` configurations (`apavel-a01` and `limontozu`) --- hosts/nix-darwin/apavel-a01/meta.nix | 1 + hosts/nix-darwin/limontozu/meta.nix | 1 + modules/flake/configurations/default.nix | 20 ++++++++++++++++---- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/hosts/nix-darwin/apavel-a01/meta.nix b/hosts/nix-darwin/apavel-a01/meta.nix index aa5d02c..98bc5ad 100644 --- a/hosts/nix-darwin/apavel-a01/meta.nix +++ b/hosts/nix-darwin/apavel-a01/meta.nix @@ -1,3 +1,4 @@ { system = "x86_64-darwin"; + enable = false; } diff --git a/hosts/nix-darwin/limontozu/meta.nix b/hosts/nix-darwin/limontozu/meta.nix index aa5d02c..98bc5ad 100644 --- a/hosts/nix-darwin/limontozu/meta.nix +++ b/hosts/nix-darwin/limontozu/meta.nix @@ -1,3 +1,4 @@ { system = "x86_64-darwin"; + enable = false; } diff --git a/modules/flake/configurations/default.nix b/modules/flake/configurations/default.nix index a9a36ff..0564e74 100644 --- a/modules/flake/configurations/default.nix +++ b/modules/flake/configurations/default.nix @@ -294,12 +294,15 @@ in # TODO: put in a more visible place default = { nixos = { - predicate = ({ root, host, configurationFiles, ... }: + predicate = ({ root, host, configurationFiles, ... }: let + meta = import "${root}/meta.nix"; + in and [ (! (host == "__template__")) (hasFiles [ "configuration.nix" "meta.nix" ] configurationFiles) + (meta.enable or true) ]); mkHost = ({ root, host, configurationFiles, ... }: let meta = import "${root}/meta.nix" // { @@ -320,12 +323,15 @@ in }); }; nix-on-droid = { - predicate = ({ root, host, configurationFiles, ... }: + predicate = ({ root, host, configurationFiles, ... }: let + meta = import "${root}/meta.nix"; + in and [ (! (host == "__template__")) (hasFiles [ "configuration.nix" "home.nix" "meta.nix" ] configurationFiles) + (meta.enable or true) ]); mkHost = ({ root, host, configurationFiles, ... }: let meta = import "${root}/meta.nix" // { @@ -340,7 +346,9 @@ in nix-darwin = { hostsName = "darwinHosts"; configurationsName = "darwinConfigurations"; - predicate = ({ root, host, configurationFiles, ... }: + predicate = ({ root, host, configurationFiles, ... }: let + meta = import "${root}/meta.nix"; + in and [ (! (host == "__template__")) (hasFiles @@ -349,6 +357,7 @@ in (hasDirectories [ "home" ] configurationFiles) + (meta.enable or true) ]); mkHost = ({ root, host, configurationFiles, ... }: let meta = import "${root}/meta.nix" // { @@ -371,12 +380,15 @@ in home-manager = { hostsName = "homeHosts"; configurationsName = "homeConfigurations"; - predicate = ({ root, host, configurationFiles, ... }: + predicate = ({ root, host, configurationFiles, ... }: let + meta = import "${root}/meta.nix"; + in and [ (! (host == "__template__")) (hasFiles [ "home.nix" "meta.nix" ] configurationFiles) + (meta.enable or true) ]); mkHost = ({ root, host, configurationFiles, ... }: let meta = import "${root}/meta.nix" // {