~ruther/nix-tmpactivator

b752f8d11d64f2c5f5210d14b4935612bff34ee6 — Rutherther 11 months ago 34acef2
feat: use buildEnv instead of .local/bin
1 files changed, 20 insertions(+), 20 deletions(-)

M modules/home.nix
M modules/home.nix => modules/home.nix +20 -20
@@ 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 = "-";

Do not follow this link