From 07ad5b45941fa3e33a70270592815fa317a14c19 Mon Sep 17 00:00:00 2001 From: Tim Keller Date: Fri, 31 Jul 2026 19:44:36 -0500 Subject: environment string instead of trying to detect env --- flake.nix | 4 ++-- module.nix | 8 +++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/flake.nix b/flake.nix index 4cc6399..1173232 100644 --- a/flake.nix +++ b/flake.nix @@ -12,7 +12,7 @@ ... }: { - hmModules.neovim-vanilla-wrapped = import ./module.nix; - nixosModules.neovim-vanilla-wrapped = import ./module.nix; + hmModules.neovim-vanilla-wrapped = import ./module.nix "home-manager"; + nixosModules.neovim-vanilla-wrapped = import ./module.nix "nixos"; }; } diff --git a/module.nix b/module.nix index e9acd17..25b508e 100644 --- a/module.nix +++ b/module.nix @@ -1,3 +1,4 @@ +environment: { lib, config, @@ -6,7 +7,6 @@ }: let cfg = config.programs.neovim-vanilla; - isHomeManager = lib.hasAttrByPath [ "home" "packages" ] config; pluginDir = let @@ -131,13 +131,15 @@ in config = lib.mkIf cfg.enable ( # NOTE: Don't use programs.neovim since that will build neovim from source in either case - if isHomeManager then + if environment == "home-manager" then { home.packages = [ finalPackage ]; } - else + else if environment == "nixos" then { environment.systemPackages = [ finalPackage ]; } + else + throw "Unknown environment: ${environment}" ); } -- cgit v1.2.3