Create a custom operator for renaming input socket in compositor
In case you haven't worked it out by now:

import bpy
import os
filepath=bpy.context.scene.render.filepath#Get absolute render path
absolutepath=bpy.path.abspath(filepath)
path=os.path.normpath(absolutepath)#Split it
parts=path.split(os.sep)
parentpath=os.sep.join(parts[:-2])
def rename(context):#Set the path for all file output nodes
    for scene in bpy.data.scenes:
        if scene.node_tree:
            for node in scene.node_tree.nodes:
                if node.type=='OUTPUT_FILE':
                    link0=node.inputs[0].links[0]#Gets the link from the input
                    socket_name=link0.from_socket.name#Returns the name of the socket the link is from
                    node.base_path=parentpath
                    node.label=socket_name
                    node.file_slots[0].path="\_"+"nom"+"_"+socket_name+"\_"+"nom"+"_"+socket_name+"_"
class FILE_OT_rename_file_outputs(bpy.types.Operator):
    """Renames file outputs"""
    bl_idname="render.rename_file_outputs"
    bl_label="Rename File Outputs"
    def execute(self,context):
        rename(context)
        return {'FINISHED'}
class FILE_PT_rename_file_outputs(bpy.types.Panel):
    """Creates a Panel in the Object properties window"""
    bl_label="File Output Manager"
    bl_space_type='PROPERTIES'
    bl_region_type='WINDOW'
    bl_context="render"
    def draw(self,context):
        layout=self.layout
        row=layout.row()
        row.operator("render.rename_file_outputs",text="Rename")
classes=[FILE_OT_rename_file_outputs,FILE_PT_rename_file_outputs]
def register():
    for c in classes:bpy.utils.register_class(c)
def unregister():
    for c in classes:bpy.utils.unregister_class(c)
if __name__=="__main__":register()