From 26244cda67cbcd5ca03c786a64823274f653fe58 Mon Sep 17 00:00:00 2001 From: Rutherther Date: Tue, 16 Apr 2024 08:10:18 +0200 Subject: [PATCH] feat: allow strings in home.packages --- modules/home.nix | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/modules/home.nix b/modules/home.nix index 5bed3d99e7dfa0bca8c06bb28a1920c66d97c7df..50276c78b62bd42f2501803bc77535f56c7f293d 100644 --- a/modules/home.nix +++ b/modules/home.nix @@ -35,7 +35,7 @@ in { }; packages = lib.mkOption { - type = lib.types.listOf lib.types.package; + type = lib.types.listOf (lib.types.oneOf [lib.types.package lib.types.str]); default = []; }; @@ -51,11 +51,22 @@ in { tmpfiles.defaultGroup = config.home.group; home.file = builtins.listToAttrs (builtins.map (pkg: - lib.nameValuePair (".local/bin/${pkg.meta.mainProgram}") { - source = (lib.getExe pkg); - executable = true; - }) - config.home.packages); + # lib.nameValuePair (".local/bin/${pkg.meta.mainProgram}") + # { executable = true; source = lib.getExe pkg; } + # ) + if lib.isDerivation pkg then + lib.nameValuePair ".local/bin/${pkg.meta.mainProgram}" + { + source = lib.getExe pkg; + executable = true; + } + else + lib.nameValuePair (builtins.unsafeDiscardStringContext ".local/bin/${builtins.baseNameOf pkg}") + { + source = pkg; + executable = true; + }) + config.home.packages); tmpfiles.files = (lib.attrValues (lib.mapAttrs (name: conf: { type = "L+";