From b752f8d11d64f2c5f5210d14b4935612bff34ee6 Mon Sep 17 00:00:00 2001 From: Rutherther Date: Fri, 19 Apr 2024 21:15:14 +0200 Subject: [PATCH] feat: use buildEnv instead of .local/bin --- modules/home.nix | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/modules/home.nix b/modules/home.nix index a9f769ddfd9534b59f43cab35914abdbc29f972a..5d2e8ced5f4827527c8da87b14e59d539ed937fb 100644 --- a/modules/home.nix +++ b/modules/home.nix @@ -35,13 +35,17 @@ in { }; packages = lib.mkOption { - type = lib.types.listOf (lib.types.oneOf [lib.types.package lib.types.str]); + type = lib.types.listOf lib.types.package; default = []; }; homeFilesPackage = lib.mkOption { type = lib.types.package; }; + + path = lib.mkOption { + type = lib.types.package; + }; }; }; @@ -50,25 +54,21 @@ in { tmpfiles.defaultUser = config.home.user; tmpfiles.defaultGroup = config.home.group; - home.file = builtins.listToAttrs (builtins.map (pkg: - # 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.instances.home.files = (lib.attrValues (lib.mapAttrs (name: conf: { + home.path = pkgs.buildEnv { + name = "tmpactivator-profile"; + paths = config.home.packages; + }; + + tmpfiles.instances.home.files = [ + { + type = "L+"; + mode = "-"; + user = "-"; + group = "-"; + text = "${config.home.path}"; + target = "${config.home.homeDirectory}/.tmpactivator-profile"; + } + ] ++ (lib.attrValues (lib.mapAttrs (name: conf: { type = "L+"; mode = "-"; user = "-";